diff --git a/addons/hr_hourly_cost/__init__.py b/addons/hr_hourly_cost/__init__.py new file mode 100644 index 00000000000..d6210b1285d --- /dev/null +++ b/addons/hr_hourly_cost/__init__.py @@ -0,0 +1,3 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import models diff --git a/addons/hr_hourly_cost/__manifest__.py b/addons/hr_hourly_cost/__manifest__.py new file mode 100644 index 00000000000..1c6fda8db0c --- /dev/null +++ b/addons/hr_hourly_cost/__manifest__.py @@ -0,0 +1,22 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +{ + 'name': 'Employee Hourly Wage', + 'version': '1.0', + 'category': 'Services/Employee Hourly Cost', + 'summary': 'Employee Hourly Wage', + 'description': """ +This module assigns an hourly wage to employees to be used by other modules. +============================================================================ + + """, + 'depends': ['hr'], + 'data': [ + 'security/hr_hourly_cost_security.xml', + 'views/hr_employee_views.xml', + ], + 'demo': [ + 'data/hr_hourly_cost_demo.xml', + ], + 'license': 'LGPL-3', +} diff --git a/addons/hr_hourly_cost/data/hr_hourly_cost_demo.xml b/addons/hr_hourly_cost/data/hr_hourly_cost_demo.xml new file mode 100644 index 00000000000..b5acd41536d --- /dev/null +++ b/addons/hr_hourly_cost/data/hr_hourly_cost_demo.xml @@ -0,0 +1,84 @@ + + + + + 100 + + + + 35 + + + + 25 + + + + 45 + + + + 55 + + + + 15 + + + + 45 + + + + 20 + + + + 40 + + + + 45 + + + + 35 + + + + 25 + + + + 40 + + + + 50 + + + + 15 + + + + 10 + + + + 75 + + + + + 65 + + + + 50 + + + + 35 + + diff --git a/addons/hr_hourly_cost/models/__init__.py b/addons/hr_hourly_cost/models/__init__.py new file mode 100644 index 00000000000..5ce9975a708 --- /dev/null +++ b/addons/hr_hourly_cost/models/__init__.py @@ -0,0 +1,3 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import hr_employee diff --git a/addons/hr_timesheet/models/hr_employee.py b/addons/hr_hourly_cost/models/hr_employee.py similarity index 76% rename from addons/hr_timesheet/models/hr_employee.py rename to addons/hr_hourly_cost/models/hr_employee.py index f5a179fa87c..c23c87a7f60 100644 --- a/addons/hr_timesheet/models/hr_employee.py +++ b/addons/hr_hourly_cost/models/hr_employee.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models @@ -7,6 +6,6 @@ from odoo import fields, models class HrEmployee(models.Model): _inherit = 'hr.employee' - timesheet_cost = fields.Monetary('Cost', currency_field='currency_id', + hourly_cost = fields.Monetary('Hourly Cost', currency_field='currency_id', groups="hr.group_hr_user", default=0.0) currency_id = fields.Many2one('res.currency', related='company_id.currency_id', readonly=True) diff --git a/addons/hr_hourly_cost/security/hr_hourly_cost_security.xml b/addons/hr_hourly_cost/security/hr_hourly_cost_security.xml new file mode 100644 index 00000000000..30318334958 --- /dev/null +++ b/addons/hr_hourly_cost/security/hr_hourly_cost_security.xml @@ -0,0 +1,11 @@ + + + + + Administrator + + + + + + diff --git a/addons/hr_hourly_cost/views/hr_employee_views.xml b/addons/hr_hourly_cost/views/hr_employee_views.xml new file mode 100644 index 00000000000..c9358efef6e --- /dev/null +++ b/addons/hr_hourly_cost/views/hr_employee_views.xml @@ -0,0 +1,21 @@ + + + + view.employee.form.inherit.hr.employee.hourly.wage + hr.employee + + + + + Application Settings + + + + + + diff --git a/addons/hr_timesheet/__manifest__.py b/addons/hr_timesheet/__manifest__.py index 741c15e59ca..6ef99c523c1 100644 --- a/addons/hr_timesheet/__manifest__.py +++ b/addons/hr_timesheet/__manifest__.py @@ -20,7 +20,7 @@ It is completely integrated with the cost accounting module. It allows you to se up a management by affair. """, 'website': 'https://www.odoo.com/app/timesheet', - 'depends': ['hr', 'analytic', 'project', 'uom'], + 'depends': ['hr', 'hr_hourly_cost', 'analytic', 'project', 'uom'], 'data': [ 'security/hr_timesheet_security.xml', 'security/ir.model.access.csv', diff --git a/addons/hr_timesheet/data/hr_timesheet_demo.xml b/addons/hr_timesheet/data/hr_timesheet_demo.xml index d1bbf0c3f19..021f1e170a8 100644 --- a/addons/hr_timesheet/data/hr_timesheet_demo.xml +++ b/addons/hr_timesheet/data/hr_timesheet_demo.xml @@ -6,88 +6,6 @@ - - - 100 - - - - 35 - - - - 25 - - - - 45 - - - - 55 - - - - 15 - - - - 45 - - - - 20 - - - - 40 - - - - 45 - - - - 35 - - - - 25 - - - - 40 - - - - 50 - - - - 15 - - - - 10 - - - - 75 - - - - - 65 - - - - 50 - - - - 35 - - diff --git a/addons/hr_timesheet/models/__init__.py b/addons/hr_timesheet/models/__init__.py index dd55d6e5b98..7cf0e88d408 100644 --- a/addons/hr_timesheet/models/__init__.py +++ b/addons/hr_timesheet/models/__init__.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import hr_employee from . import hr_timesheet from . import ir_http from . import ir_ui_menu diff --git a/addons/hr_timesheet/models/hr_timesheet.py b/addons/hr_timesheet/models/hr_timesheet.py index 250a3a82565..83a6e23327d 100644 --- a/addons/hr_timesheet/models/hr_timesheet.py +++ b/addons/hr_timesheet/models/hr_timesheet.py @@ -284,7 +284,7 @@ class AccountAnalyticLine(models.Model): # (re)compute the amount (depending on unit_amount, employee_id for the cost, and account_id for currency) if any(field_name in values for field_name in ['unit_amount', 'employee_id', 'account_id']): for timesheet in sudo_self: - cost = timesheet._employee_timesheet_cost() + cost = timesheet._hourly_cost() amount = -timesheet.unit_amount * cost amount_converted = timesheet.employee_id.currency_id._convert( amount, timesheet.account_id.currency_id or timesheet.currency_id, self.env.company, timesheet.date) @@ -306,9 +306,9 @@ class AccountAnalyticLine(models.Model): def _get_timesheet_time_day(self): return self._convert_hours_to_days(self.unit_amount) - def _employee_timesheet_cost(self): + def _hourly_cost(self): self.ensure_one() - return self.employee_id.timesheet_cost or 0.0 + return self.employee_id.hourly_cost or 0.0 def _get_report_base_filename(self): task_ids = self.task_id diff --git a/addons/hr_timesheet/security/hr_timesheet_security.xml b/addons/hr_timesheet/security/hr_timesheet_security.xml index 9f105179167..63135d39cb7 100644 --- a/addons/hr_timesheet/security/hr_timesheet_security.xml +++ b/addons/hr_timesheet/security/hr_timesheet_security.xml @@ -22,7 +22,8 @@ Administrator - + diff --git a/addons/hr_timesheet/tests/test_timesheet.py b/addons/hr_timesheet/tests/test_timesheet.py index 8de9c1a40fc..4df8cf990bf 100644 --- a/addons/hr_timesheet/tests/test_timesheet.py +++ b/addons/hr_timesheet/tests/test_timesheet.py @@ -253,8 +253,8 @@ class TestTimesheet(TestCommonTimesheet): def test_recompute_amount_for_multiple_timesheets(self): """ Check that amount is recomputed correctly when setting unit_amount for multiple timesheets at once. """ Timesheet = self.env['account.analytic.line'] - self.empl_employee.timesheet_cost = 5.0 - self.empl_employee2.timesheet_cost = 6.0 + self.empl_employee.hourly_cost = 5.0 + self.empl_employee2.hourly_cost = 6.0 # create a timesheet for each employee timesheet_1 = Timesheet.with_user(self.user_employee).create({ 'project_id': self.project_customer.id, diff --git a/addons/hr_timesheet/views/hr_views.xml b/addons/hr_timesheet/views/hr_views.xml index 7b650c588e2..9ea0e8cdb2e 100644 --- a/addons/hr_timesheet/views/hr_views.xml +++ b/addons/hr_timesheet/views/hr_views.xml @@ -30,19 +30,9 @@ hr.employee.form.timesheet hr.employee - + - - Application Settings - - -