Duty Working Hours/Days in Month
by T.V.T Marine Automation (aka TVTMA) https://viindoo.com , Viindoo https://viindoo.com$ 52.38
Availability |
Odoo Online
Odoo.sh
On Premise
|
Odoo Apps Dependencies |
•
Leaves (hr_holidays)
• Employees (hr) • Discuss (mail) • Calendar (calendar) |
Lines of code | 266 |
Technical Name |
to_hr_scheduled_working_days |
License | OPL-1 |
Website | https://viindoo.com |
Versions | 10.0 11.0 12.0 |
Problems
Is it convenient for you to calculate basic wage for an employee working from 2018/02/20 ~ 2018/02/28?
As an end user with very basic technical knowledge, it seems to be impossible for you to - find out number of worked days nor number of full month working days of that full month - find out the hour rate which is calculated by: contract basic wage / full month working hours (Odoo, in the payslip, does not know full month working hours of that Feb 2018)
- Assume that
- Basic Wage: 1000
- Payslip Period: 2018/02/20 ~ 2018/02/28
- Working Schedule: 44 Hours a week
- What you may expect to have
- the total month working hours of the Feb 2018 is 176
- the total month working days of the Feb 2018 is 22
- the duty working hours of the employee of the payslip is 60
- the duty working days of the employee of the payslip is 8
The Solution
- This module solves the problem above mentioned by providing the following data into employee payslips:
- Month: a single month of the payslip's
- Duty Working Hours: the total hours of the month the employee of the payslip has to work according to the payslip period
- Duty Working Days: the total days of the month the employee of the payslip has to work according to the payslip period.
- Month Working Hours: the total working hours of the FULL month according to the working schedule, no matter what the payslip period is
- Month Working Days: the total working days of the FULL month according to the working schedule, no matter what the payslip period is
- In case a pay slip crosses months, the data should be a table where each row is a set of the data above mentioned.
How to apply for Salary Rules
- Basic Wage Calculation (no leave consideration)
- result = sum(line.duty_working_hours * (contract.wage / line.month_working_hours) for line in payslip.working_month_calendar_ids)
- Fixed Monthly allowance Calculation (no leave consideration)
- result = sum(line.duty_working_hours * (contract.allowance / line.month_working_hours) for line in payslip.working_month_calendar_ids)
Known Issues
1. Duty Working Days and Month Working Days are calculated based on the conversion of the unit of measure Hour(s) -> Day(s) whose default value is 8.0 hours per day. In case your working hours of a day may vary across your resource calendar, do NOT use this for salary computation. Switch to hours base calculation should be PERFECT!
Editions Supported
- Community Edition
- Enterprise Edition
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module
Report comment
Any abuse of this reporting system will be penalizedThere are no ratings yet!
I am having a bug with your module
Odoo Server Error Traceback (most recent call last): File "/opt/odoo12/odoo/odoo/api.py", line 1049, in get value = self._data[key][field][record._ids[0]] KeyError: 2 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo12/odoo/odoo/fields.py", line 984, in __get__ value = record.env.cache.get(record, self) File "/opt/odoo12/odoo/odoo/api.py", line 1051, in get raise CacheMiss(record, field) odoo.exceptions.CacheMiss: ('hr.working.month.calendar.line(2,).duty_working_days', None) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo12/odoo/odoo/http.py", line 656, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/opt/odoo12/odoo/odoo/http.py", line 314, in _handle_exception raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/opt/odoo12/odoo/odoo/tools/pycompat.py", line 87, in reraise raise value File "/opt/odoo12/odoo/odoo/http.py", line 698, in dispatch result = self._call_function(**self.params) File "/opt/odoo12/odoo/odoo/http.py", line 346, in _call_function return checked_call(self.db, *args, **kwargs) File "/opt/odoo12/odoo/odoo/service/model.py", line 97, in wrapper return f(dbname, *args, **kwargs) File "/opt/odoo12/odoo/odoo/http.py", line 339, in checked_call result = self.endpoint(*a, **kw) File "/opt/odoo12/odoo/odoo/http.py", line 941, in __call__ return self.method(*args, **kw) File "/opt/odoo12/odoo/odoo/http.py", line 519, in response_wrap response = f(*args, **kw) File "/opt/odoo12/odoo/addons/web/controllers/main.py", line 966, in call_button action = self._call_kw(model, method, args, {}) File "/opt/odoo12/odoo/addons/web/controllers/main.py", line 954, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/opt/odoo12/odoo/odoo/api.py", line 759, in call_kw return _call_kw_multi(method, model, args, kwargs) File "/opt/odoo12/odoo/odoo/api.py", line 746, in _call_kw_multi result = method(recs, *args, **kwargs) File "/opt/odoo12/others_apps/to_hr_scheduled_working_days/models/hr_payslip.py", line 14, in compute_sheet self._generate_working_month_calendars() File "/opt/odoo12/others_apps/to_hr_scheduled_working_days/models/hr_payslip.py", line 67, in _generate_working_month_calendars MonthWorkingDay.create(data) File "", line 2, in create File "/opt/odoo12/odoo/odoo/api.py", line 461, in _model_create_multi return create(self, [arg]) File "/opt/odoo12/odoo/odoo/models.py", line 3613, in create self.recompute() File "/opt/odoo12/odoo/odoo/models.py", line 5276, in recompute vals = {n: rec[n] for n in ns} File "/opt/odoo12/odoo/odoo/models.py", line 5276, in vals = {n: rec[n] for n in ns} File "/opt/odoo12/odoo/odoo/models.py", line 5123, in __getitem__ return self._fields[key].__get__(self, type(self)) File "/opt/odoo12/odoo/odoo/fields.py", line 988, in __get__ self.determine_value(record) File "/opt/odoo12/odoo/odoo/fields.py", line 1077, in determine_value self.compute_value(recs) File "/opt/odoo12/odoo/odoo/fields.py", line 1055, in compute_value self._compute_value(records) File "/opt/odoo12/odoo/odoo/fields.py", line 1046, in _compute_value getattr(records, self.compute)() File "/opt/odoo12/others_apps/to_hr_scheduled_working_days/models/hr_working_month_calendar_line.py", line 52, in _compute_duty_working_days duty_data = r.working_month_calendar_id.payslip_id.employee_id.get_work_days_data(date_from, date_to, compute_leaves=False, calendar=r.working_month_calendar_id.payslip_id.contract_id.resource_calendar_id) TypeError: get_work_days_data() got an unexpected keyword argument 'compute_leaves'
Re: I am having a bug with your module
It seemed that you installed the module for Odoo 12 on an Odoo 11 deployment when he error message said TypeError: get_work_days_data() got an unexpected keyword argument 'compute_leaves'. In Odoo 11, the method `get_work_days_data` has no compute_leaves argument.
TypeError: get_work_days_data() got an unexpected keyword argument 'compute_leaves'
I am having the following issue while trying to compute the salary of an employee: Odoo Server Error Traceback (most recent call last): File "/opt/odoo12/odoo/odoo/api.py", line 1049, in get value = self._data[key][field][record._ids[0]] KeyError: 2 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo12/odoo/odoo/fields.py", line 984, in __get__ value = record.env.cache.get(record, self) File "/opt/odoo12/odoo/odoo/api.py", line 1051, in get raise CacheMiss(record, field) odoo.exceptions.CacheMiss: ('hr.working.month.calendar.line(2,).calendar_working_days', None) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo12/odoo/odoo/http.py", line 656, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/opt/odoo12/odoo/odoo/http.py", line 314, in _handle_exception raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/opt/odoo12/odoo/odoo/tools/pycompat.py", line 87, in reraise raise value File "/opt/odoo12/odoo/odoo/http.py", line 698, in dispatch result = self._call_function(**self.params) File "/opt/odoo12/odoo/odoo/http.py", line 346, in _call_function return checked_call(self.db, *args, **kwargs) File "/opt/odoo12/odoo/odoo/service/model.py", line 97, in wrapper return f(dbname, *args, **kwargs) File "/opt/odoo12/odoo/odoo/http.py", line 339, in checked_call result = self.endpoint(*a, **kw) File "/opt/odoo12/odoo/odoo/http.py", line 941, in __call__ return self.method(*args, **kw) File "/opt/odoo12/odoo/odoo/http.py", line 519, in response_wrap response = f(*args, **kw) File "/opt/odoo12/odoo/addons/web/controllers/main.py", line 966, in call_button action = self._call_kw(model, method, args, {}) File "/opt/odoo12/odoo/addons/web/controllers/main.py", line 954, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/opt/odoo12/odoo/odoo/api.py", line 759, in call_kw return _call_kw_multi(method, model, args, kwargs) File "/opt/odoo12/odoo/odoo/api.py", line 746, in _call_kw_multi result = method(recs, *args, **kwargs) File "/opt/odoo12/others_apps/to_hr_scheduled_working_days/models/hr_payslip.py", line 14, in compute_sheet self._generate_working_month_calendars() File "/opt/odoo12/others_apps/to_hr_scheduled_working_days/models/hr_payslip.py", line 67, in _generate_working_month_calendars MonthWorkingDay.create(data) File "", line 2, in create File "/opt/odoo12/odoo/odoo/api.py", line 461, in _model_create_multi return create(self, [arg]) File "/opt/odoo12/odoo/odoo/models.py", line 3613, in create self.recompute() File "/opt/odoo12/odoo/odoo/models.py", line 5276, in recompute vals = {n: rec[n] for n in ns} File "/opt/odoo12/odoo/odoo/models.py", line 5276, in vals = {n: rec[n] for n in ns} File "/opt/odoo12/odoo/odoo/models.py", line 5123, in __getitem__ return self._fields[key].__get__(self, type(self)) File "/opt/odoo12/odoo/odoo/fields.py", line 988, in __get__ self.determine_value(record) File "/opt/odoo12/odoo/odoo/fields.py", line 1077, in determine_value self.compute_value(recs) File "/opt/odoo12/odoo/odoo/fields.py", line 1055, in compute_value self._compute_value(records) File "/opt/odoo12/odoo/odoo/fields.py", line 1046, in _compute_value getattr(records, self.compute)() File "/opt/odoo12/others_apps/to_hr_scheduled_working_days/models/hr_working_month_calendar_line.py", line 66, in _compute_calendar_working_days calendar_data = r.working_month_calendar_id.payslip_id.employee_id.get_work_days_data(date_from, date_to, compute_leaves=False, calendar=r.working_month_calendar_id.payslip_id.contract_id.resource_calendar_id) TypeError: get_work_days_data() got an unexpected keyword argument 'compute_leaves'
Re: TypeError: get_work_days_data() got an unexpected keyword argument 'compute_leaves'
It seemed that you installed the module for Odoo 12 on an Odoo 11 deployment when he error message said TypeError: get_work_days_data() got an unexpected keyword argument 'compute_leaves'. In Odoo 11, the method `get_work_days_data` has no compute_leaves argument.