From 0c15e1f7eef9f91da27538d6562d9fc49478d9d9 Mon Sep 17 00:00:00 2001 From: FernandoRomera Date: Thu, 21 Dec 2023 08:44:13 +0100 Subject: [PATCH] [17.0][MIG] payroll: Migration to 17.0 --- payroll/README.rst | 12 +++--- payroll/__manifest__.py | 2 +- payroll/models/base_browsable.py | 2 +- payroll/models/hr_payroll_structure.py | 2 +- payroll/models/hr_payslip.py | 14 +------ payroll/models/hr_payslip_line.py | 9 ++-- payroll/models/hr_payslip_run.py | 7 +--- payroll/models/hr_salary_rule.py | 4 +- payroll/pyproject.toml | 3 ++ payroll/static/description/index.html | 8 ++-- payroll/tests/common.py | 2 +- payroll/tests/test_browsable_object.py | 2 - payroll/tests/test_hr_payroll_cancel.py | 2 +- payroll/tests/test_hr_payslip_change_state.py | 2 +- payroll/tests/test_hr_payslip_worked_days.py | 3 -- payroll/tests/test_hr_salary_rule.py | 28 ++++++++----- payroll/tests/test_payslip_flow.py | 22 +++------- payroll/views/hr_payroll_structure_views.xml | 5 +-- payroll/views/hr_payslip_line_views.xml | 19 +++------ payroll/views/hr_payslip_run_views.xml | 10 +++-- payroll/views/hr_payslip_views.xml | 32 +++++++------- .../views/hr_salary_rule_category_views.xml | 5 +-- payroll/views/hr_salary_rule_views.xml | 42 +++++++++++-------- payroll/wizard/hr_payslip_change_state.py | 1 - 24 files changed, 103 insertions(+), 135 deletions(-) create mode 100644 payroll/pyproject.toml diff --git a/payroll/README.rst b/payroll/README.rst index 088a19ea..9a868d87 100644 --- a/payroll/README.rst +++ b/payroll/README.rst @@ -7,7 +7,7 @@ Payroll !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:706eec2567f796489027660b9a221865aee1332ce603aaeebfefafcc412d994c + !! source digest: sha256:def4f708faf4767d5767c515426c572391d63f2a30ffde152f86d3a019c0b920 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -17,13 +17,13 @@ Payroll :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpayroll-lightgray.png?logo=github - :target: https://github.com/OCA/payroll/tree/16.0/payroll + :target: https://github.com/OCA/payroll/tree/17.0/payroll :alt: OCA/payroll .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/payroll-16-0/payroll-16-0-payroll + :target: https://translation.odoo-community.org/projects/payroll-17-0/payroll-17-0-payroll :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/payroll&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/payroll&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -43,7 +43,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -88,6 +88,6 @@ Current `maintainers `__: |maintainer-appstogrow| |maintainer-nimarosa| -This module is part of the `OCA/payroll `_ project on GitHub. +This module is part of the `OCA/payroll `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/payroll/__manifest__.py b/payroll/__manifest__.py index 76008e49..b23f35e7 100644 --- a/payroll/__manifest__.py +++ b/payroll/__manifest__.py @@ -2,7 +2,7 @@ { "name": "Payroll", - "version": "16.0.1.1.0", + "version": "17.0.1.0.0", "category": "Payroll", "website": "https://github.com/OCA/payroll", "sequence": 38, diff --git a/payroll/models/base_browsable.py b/payroll/models/base_browsable.py index 58333ce8..249b04b3 100644 --- a/payroll/models/base_browsable.py +++ b/payroll/models/base_browsable.py @@ -7,7 +7,7 @@ _logger = logging.getLogger(__name__) -class BaseBrowsableObject(object): +class BaseBrowsableObject: def __init__(self, vals_dict): self.__dict__["base_fields"] = ["base_fields", "dict"] self.dict = vals_dict diff --git a/payroll/models/hr_payroll_structure.py b/payroll/models/hr_payroll_structure.py index 6ccbf11a..f5d9d6d9 100644 --- a/payroll/models/hr_payroll_structure.py +++ b/payroll/models/hr_payroll_structure.py @@ -66,7 +66,7 @@ def _check_parent_id(self): def copy(self, default=None): self.ensure_one() default = dict(default or {}, code=_("%s (copy)") % self.code) - return super(HrPayrollStructure, self).copy(default) + return super().copy(default) def get_all_rules(self): """ diff --git a/payroll/models/hr_payslip.py b/payroll/models/hr_payslip.py index 6a0e6a7f..f2c2b0ca 100644 --- a/payroll/models/hr_payslip.py +++ b/payroll/models/hr_payslip.py @@ -54,13 +54,11 @@ class HrPayslip(models.Model): string="Employee", required=True, readonly=True, - states={"draft": [("readonly", False)]}, ) date_from = fields.Date( readonly=True, required=True, default=lambda self: fields.Date.to_string(date.today().replace(day=1)), - states={"draft": [("readonly", False)]}, tracking=True, ) date_to = fields.Date( @@ -69,7 +67,6 @@ class HrPayslip(models.Model): default=lambda self: fields.Date.to_string( (datetime.now() + relativedelta(months=+1, day=1, days=-1)).date() ), - states={"draft": [("readonly", False)]}, tracking=True, ) state = fields.Selection( @@ -95,7 +92,6 @@ class HrPayslip(models.Model): "slip_id", string="Payslip Lines", readonly=True, - states={"draft": [("readonly", False)]}, ) company_id = fields.Many2one( "res.company", @@ -103,7 +99,6 @@ class HrPayslip(models.Model): readonly=True, copy=False, default=lambda self: self.env.company, - states={"draft": [("readonly", False)]}, ) worked_days_line_ids = fields.One2many( "hr.payslip.worked_days", @@ -111,25 +106,21 @@ class HrPayslip(models.Model): string="Payslip Worked Days", copy=True, readonly=True, - states={"draft": [("readonly", False)]}, ) input_line_ids = fields.One2many( "hr.payslip.input", "payslip_id", string="Payslip Inputs", readonly=True, - states={"draft": [("readonly", False)]}, ) paid = fields.Boolean( string="Made Payment Order ? ", readonly=True, copy=False, - states={"draft": [("readonly", False)]}, ) note = fields.Text( string="Internal Note", readonly=True, - states={"draft": [("readonly", False)]}, tracking=True, ) contract_id = fields.Many2one( @@ -137,7 +128,6 @@ class HrPayslip(models.Model): string="Contract", readonly=True, tracking=True, - states={"draft": [("readonly", False)]}, ) dynamic_filtered_payslip_lines = fields.One2many( "hr.payslip.line", @@ -145,7 +135,6 @@ class HrPayslip(models.Model): ) credit_note = fields.Boolean( readonly=True, - states={"draft": [("readonly", False)]}, help="Indicates this payslip has a refund of another", ) payslip_run_id = fields.Many2one( @@ -154,7 +143,6 @@ class HrPayslip(models.Model): readonly=True, copy=False, tracking=True, - states={"draft": [("readonly", False)]}, ) payslip_count = fields.Integer( compute="_compute_payslip_count", string="Payslip Computation Details" @@ -279,7 +267,7 @@ def unlink(self): raise UserError( _("You cannot delete a payslip which is not draft or cancelled") ) - return super(HrPayslip, self).unlink() + return super().unlink() def compute_sheet(self): for payslip in self: diff --git a/payroll/models/hr_payslip_line.py b/payroll/models/hr_payslip_line.py index e56562d6..379a4ce7 100644 --- a/payroll/models/hr_payslip_line.py +++ b/payroll/models/hr_payslip_line.py @@ -55,9 +55,10 @@ def _compute_parent_line_id(self): for line in self: if line.parent_rule_id: parent_line = line.slip_id.line_ids.filtered( - lambda l: l.salary_rule_id == line.parent_rule_id - and l.contract_id == line.contract_id - and l.slip_id == line.slip_id + lambda record, line=line: record.salary_rule_id + == line.parent_rule_id + and record.contract_id == line.contract_id + and record.slip_id == line.slip_id ) if parent_line and len(parent_line) > 1: raise UserError( @@ -92,4 +93,4 @@ def create(self, vals_list): raise UserError( _("You must set a contract to create a payslip line.") ) - return super(HrPayslipLine, self).create(vals_list) + return super().create(vals_list) diff --git a/payroll/models/hr_payslip_run.py b/payroll/models/hr_payslip_run.py index cf77c2a0..b6ee18ba 100644 --- a/payroll/models/hr_payslip_run.py +++ b/payroll/models/hr_payslip_run.py @@ -12,14 +12,13 @@ class HrPayslipRun(models.Model): _order = "id desc" name = fields.Char( - required=True, readonly=True, states={"draft": [("readonly", False)]} + required=True, readonly=True ) slip_ids = fields.One2many( "hr.payslip", "payslip_run_id", string="Payslips", readonly=True, - states={"draft": [("readonly", False)]}, ) state = fields.Selection( [("draft", "Draft"), ("close", "Close")], @@ -41,20 +40,17 @@ class HrPayslipRun(models.Model): string="Date From", required=True, readonly=True, - states={"draft": [("readonly", False)]}, default=lambda self: fields.Date.today().replace(day=1), ) date_end = fields.Date( string="Date To", required=True, readonly=True, - states={"draft": [("readonly", False)]}, default=lambda self: fields.Date.today().replace(day=1) + relativedelta(months=+1, day=1, days=-1), ) credit_note = fields.Boolean( readonly=True, - states={"draft": [("readonly", False)]}, help="If its checked, indicates that all payslips generated from here " "are refund payslips.", ) @@ -62,7 +58,6 @@ class HrPayslipRun(models.Model): "hr.payroll.structure", string="Structure", readonly=True, - states={"draft": [("readonly", False)]}, help="Defines the rules that have to be applied to this payslip batch, " "accordingly to the contract chosen. If you let empty the field " "contract, this field isn't mandatory anymore and thus the rules " diff --git a/payroll/models/hr_salary_rule.py b/payroll/models/hr_salary_rule.py index 19559d55..be94a40e 100644 --- a/payroll/models/hr_salary_rule.py +++ b/payroll/models/hr_salary_rule.py @@ -208,7 +208,7 @@ def _compute_rule(self, localdict): :rtype: {"name": string, "quantity": float, "rate": float, "amount": float} """ self.ensure_one() - method = "_compute_rule_{}".format(self.amount_select) + method = f"_compute_rule_{self.amount_select}" return api.call_kw(self, method, [self.ids, localdict], {}) def _compute_rule_fix(self, localdict): @@ -285,7 +285,7 @@ def _satisfy_condition(self, localdict): given contract. Return False otherwise. """ self.ensure_one() - method = "_satisfy_condition_{}".format(self.condition_select) + method = f"_satisfy_condition_{self.condition_select}" if self.parent_rule_id: current_result = api.call_kw(self, method, [self.ids, localdict], {}) parent_result = self.parent_rule_id._satisfy_condition(localdict) diff --git a/payroll/pyproject.toml b/payroll/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/payroll/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/payroll/static/description/index.html b/payroll/static/description/index.html index 2926bcaf..4a2eb965 100644 --- a/payroll/static/description/index.html +++ b/payroll/static/description/index.html @@ -367,9 +367,9 @@

Payroll

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:706eec2567f796489027660b9a221865aee1332ce603aaeebfefafcc412d994c +!! source digest: sha256:def4f708faf4767d5767c515426c572391d63f2a30ffde152f86d3a019c0b920 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/payroll Translate me on Weblate Try me on Runboat

+

Beta License: LGPL-3 OCA/payroll Translate me on Weblate Try me on Runboat

Manage your employee payroll records.

This module is a backport from Odoo SA and as such, it is not included in the OCA CLA. That means we do not have a copy of the copyright on it like all other OCA modules.

Table of contents

@@ -389,7 +389,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -419,7 +419,7 @@

Maintainers

promote its widespread use.

Current maintainers:

appstogrow nimarosa

-

This module is part of the OCA/payroll project on GitHub.

+

This module is part of the OCA/payroll project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/payroll/tests/common.py b/payroll/tests/common.py index 950c57f5..4c690e0e 100644 --- a/payroll/tests/common.py +++ b/payroll/tests/common.py @@ -7,7 +7,7 @@ class TestPayslipBase(TransactionCase): def setUp(self): - super(TestPayslipBase, self).setUp() + super().setUp() self.CalendarAttendance = self.env["resource.calendar.attendance"] self.Contract = self.env["hr.contract"] diff --git a/payroll/tests/test_browsable_object.py b/payroll/tests/test_browsable_object.py index b5c5f174..9a0762db 100644 --- a/payroll/tests/test_browsable_object.py +++ b/payroll/tests/test_browsable_object.py @@ -11,7 +11,6 @@ def setUp(self): super().setUp() def test_init(self): - obj = BrowsableObject(self.richard_emp.id, {"test": 1}, self.env) self.assertEqual(obj.test, 1, "Simple initialization") @@ -51,7 +50,6 @@ def test_init(self): ) def test_update_attribute(self): - obj = BrowsableObject( self.richard_emp.id, { diff --git a/payroll/tests/test_hr_payroll_cancel.py b/payroll/tests/test_hr_payroll_cancel.py index 5ad8723b..75855cf2 100644 --- a/payroll/tests/test_hr_payroll_cancel.py +++ b/payroll/tests/test_hr_payroll_cancel.py @@ -10,7 +10,7 @@ class TestHrPayrollCancel(common.TransactionCase): def setUp(self): - super(TestHrPayrollCancel, self).setUp() + super().setUp() # Set system parameter self.env["ir.config_parameter"].sudo().set_param( "payroll.allow_cancel_payslips", True diff --git a/payroll/tests/test_hr_payslip_change_state.py b/payroll/tests/test_hr_payslip_change_state.py index 609bac41..fd97b907 100644 --- a/payroll/tests/test_hr_payslip_change_state.py +++ b/payroll/tests/test_hr_payslip_change_state.py @@ -9,7 +9,7 @@ class TestHrPayslipChangeState(TestHrPayrollCancel): def setUp(self): - super(TestHrPayslipChangeState, self).setUp() + super().setUp() self.tested_model = self.env["hr.payslip.change.state"] def test_change_state(self): diff --git a/payroll/tests/test_hr_payslip_worked_days.py b/payroll/tests/test_hr_payslip_worked_days.py index 742ae238..93257526 100644 --- a/payroll/tests/test_hr_payslip_worked_days.py +++ b/payroll/tests/test_hr_payslip_worked_days.py @@ -54,7 +54,6 @@ def setUp(self): ) def _common_contract_leave_setup(self): - self.richard_emp.resource_id.calendar_id = self.full_calendar self.richard_emp.contract_ids.resource_calendar_id = self.full_calendar @@ -74,7 +73,6 @@ def _common_contract_leave_setup(self): ) def test_worked_days_negative(self): - self._common_contract_leave_setup() # Set system parameter @@ -107,7 +105,6 @@ def test_worked_days_negative(self): ) def test_leaves_positive(self): - self._common_contract_leave_setup() # Set system parameter diff --git a/payroll/tests/test_hr_salary_rule.py b/payroll/tests/test_hr_salary_rule.py index 7075b1cf..32935562 100644 --- a/payroll/tests/test_hr_salary_rule.py +++ b/payroll/tests/test_hr_salary_rule.py @@ -50,7 +50,6 @@ def setUp(self): ) def test_python_code_return_values(self): - self.test_rule.amount_python_compute = ( "result_rate = 0\n" "result_qty = 0\n" "result = 0\n" ) @@ -67,7 +66,7 @@ def test_python_code_return_values(self): payslip.onchange_employee() payslip.compute_sheet() - line = payslip.line_ids.filtered(lambda l: l.code == "TEST") + line = payslip.line_ids.filtered(lambda record: record.code == "TEST") self.assertEqual(len(line), 1, "I found the Test line") self.assertEqual(line.amount, 0.0, "The amount is zero") self.assertEqual(line.rate, 0.0, "The rate is zero") @@ -75,7 +74,6 @@ def test_python_code_return_values(self): self.assertEqual(line.code, "TEST", "The code is 'TEST'") def test_python_code_result_not_set(self): - self.test_rule.amount_python_compute = "result = 2" # Open contracts @@ -90,7 +88,7 @@ def test_python_code_result_not_set(self): payslip.onchange_employee() payslip.compute_sheet() - line = payslip.line_ids.filtered(lambda l: l.code == "TEST") + line = payslip.line_ids.filtered(lambda record: record.code == "TEST") self.assertEqual(len(line), 1, "I found the Test line") self.assertEqual(line.amount, 2.0, "The amount is zero") self.assertEqual(line.rate, 100.0, "The rate is zero") @@ -110,7 +108,7 @@ def test_parent_child_order(self): payslip.compute_sheet() # Check child test rule calculated without being in the structure - line = payslip.line_ids.filtered(lambda l: l.code == "CHILD_TEST") + line = payslip.line_ids.filtered(lambda record: record.code == "CHILD_TEST") self.assertEqual(len(line), 1, "Child line founded") # Change sequence of child rule to calculate before of the parent rule @@ -122,7 +120,7 @@ def test_parent_child_order(self): payslip.compute_sheet() # Child rule should be computed - line = payslip.line_ids.filtered(lambda l: l.code == "CHILD_TEST") + line = payslip.line_ids.filtered(lambda record: record.code == "CHILD_TEST") self.assertEqual(len(line), 1, "Child line founded") # Change the parent rule condition to return False @@ -135,8 +133,12 @@ def test_parent_child_order(self): payslip.compute_sheet() # Parent and child rule should not be calculated even if child rule condition is true - parent_line = payslip.line_ids.filtered(lambda l: l.code == "PARENT_TEST") - child_line = payslip.line_ids.filtered(lambda l: l.code == "CHILD_TEST") + parent_line = payslip.line_ids.filtered( + lambda record: record.code == "PARENT_TEST" + ) + child_line = payslip.line_ids.filtered( + lambda record: record.code == "CHILD_TEST" + ) self.assertEqual(len(parent_line), 0, "No parent line found") self.assertEqual(len(child_line), 0, "No child line found") @@ -188,9 +190,13 @@ def test_rule_and_category_with_and_without_code(self): } ) payslip.compute_sheet() - line = payslip.line_ids.filtered(lambda l: l.code == "rule_test_code") + line = payslip.line_ids.filtered(lambda record: record.code == "rule_test_code") self.assertEqual(line.total, 7000, "5000 categories.BASIC + 2000 HRA = 7000") - line = payslip.line_ids.filtered(lambda l: l.name == "rule without code") + line = payslip.line_ids.filtered( + lambda record: record.name == "rule without code" + ) self.assertEqual(len(line), 1, "Line found: rule without code") - line = payslip.line_ids.filtered(lambda l: l.name == "rule without category") + line = payslip.line_ids.filtered( + lambda record: record.name == "rule without category" + ) self.assertEqual(len(line), 1, "Line found: rule without category") diff --git a/payroll/tests/test_payslip_flow.py b/payroll/tests/test_payslip_flow.py index 87065877..130003df 100644 --- a/payroll/tests/test_payslip_flow.py +++ b/payroll/tests/test_payslip_flow.py @@ -56,7 +56,7 @@ def test_00_payslip_flow(self): # Check child rules shown in table by default child_line = richard_payslip.dynamic_filtered_payslip_lines.filtered( - lambda l: l.code == "NET_CHILD" + lambda record: record.code == "NET_CHILD" ) self.assertEqual( len(child_line), 1, "Child line found when flag desactivated (default)" @@ -64,7 +64,7 @@ def test_00_payslip_flow(self): # Check parent line id value is correct parent_line = richard_payslip.dynamic_filtered_payslip_lines.filtered( - lambda l: l.code == "NET" + lambda record: record.code == "NET" ) self.assertEqual( child_line.parent_line_id.code, @@ -82,7 +82,7 @@ def test_00_payslip_flow(self): # Check child rules not shown in table after flag changed child_line = richard_payslip.dynamic_filtered_payslip_lines.filtered( - lambda l: l.code == "NET_CHILD" + lambda record: record.code == "NET_CHILD" ) self.assertEqual( len(child_line), 0, "The child line is not found when flag activated" @@ -93,7 +93,7 @@ def test_00_payslip_flow(self): work100 = richard_payslip.worked_days_line_ids.filtered( lambda x: x.code == "WORK100" ) - line = richard_payslip.line_ids.filtered(lambda l: l.code == "NET") + line = richard_payslip.line_ids.filtered(lambda record: record.code == "NET") self.assertEqual(len(line), 1, "I found the 'NET' line") self.assertEqual( line[0].amount, @@ -169,7 +169,6 @@ def test_00_payslip_flow(self): ) def test_contract_qty(self): - # I set the test rule to detect contract count self.test_rule.amount_python_compute = ( "result = payroll.contracts and payroll.contracts.count or -1.0" @@ -184,14 +183,13 @@ def test_contract_qty(self): richard_payslip.onchange_employee() richard_payslip.compute_sheet() - line = richard_payslip.line_ids.filtered(lambda l: l.code == "TEST") + line = richard_payslip.line_ids.filtered(lambda record: record.code == "TEST") self.assertEqual(len(line), 1, "I found the Test line") self.assertEqual( line[0].amount, 1.0, "The calculated dictionary value 'contracts.qty' is 1" ) def test_compute_multiple_payslips(self): - self.apply_contract_cron() payslips = self.Payslip.create( [ @@ -211,7 +209,6 @@ def test_compute_multiple_payslips(self): ) def test_get_contracts_singleton(self): - payslip = self.Payslip.create({"employee_id": self.sally.id}) contracts = payslip._get_employee_contracts() self.assertFalse(contracts, "No currently open contracts for the employee") @@ -240,7 +237,6 @@ def test_get_contracts_singleton(self): ) def test_get_contracts_multiple(self): - self.sally.contract_ids[0].date_end = Date.today().strftime("%Y-%m-15") self.Contract.create( { @@ -267,7 +263,6 @@ def test_get_contracts_multiple(self): ) def test_compute_sheet_no_valid_contract(self): - frm = Form(self.Payslip) frm.employee_id = self.richard_emp payslip = frm.save() @@ -300,7 +295,6 @@ def _get_sales_rules(self): return sales_rules def test_use_different_structure(self): - developer_rules = self._get_developer_rules() self.apply_contract_cron() @@ -320,7 +314,6 @@ def test_use_different_structure(self): ) def test_get_salary_rules_singleton(self): - developer_rules = self._get_developer_rules() self.apply_contract_cron() @@ -339,7 +332,6 @@ def test_get_salary_rules_singleton(self): ) def test_get_salary_rules_multi(self): - sales_allowance = self.SalaryRule.create( { "name": "Sales Allowance", @@ -390,7 +382,6 @@ def test_get_payslip_line_singleton(self): ) def test_get_payslip_line_multi(self): - self.apply_contract_cron() payslips = self.Payslip.create( [ @@ -411,7 +402,6 @@ def test_get_payslip_line_multi(self): ) def test_onchange_struct_id_singleton(self): - new_struct = self.PayrollStructure.create( { "name": "Simple Structure", @@ -448,7 +438,6 @@ def test_onchange_struct_id_singleton(self): ) def test_onchange_struct_id_multi(self): - new_struct = self.PayrollStructure.create( { "name": "Simple Structure", @@ -543,7 +532,6 @@ def test_onchange_dates_multi(self): ) def test_onchange_employee(self): - self.apply_contract_cron() payslip = self.Payslip.create({"employee_id": self.sally.id}) payslip.name = "Random name Foo" diff --git a/payroll/views/hr_payroll_structure_views.xml b/payroll/views/hr_payroll_structure_views.xml index 7731da80..5cbc5283 100644 --- a/payroll/views/hr_payroll_structure_views.xml +++ b/payroll/views/hr_payroll_structure_views.xml @@ -82,10 +82,7 @@ - + - - - + + + @@ -51,12 +42,12 @@ diff --git a/payroll/views/hr_payslip_run_views.xml b/payroll/views/hr_payslip_run_views.xml index 61db5297..fed26d82 100644 --- a/payroll/views/hr_payslip_run_views.xml +++ b/payroll/views/hr_payslip_run_views.xml @@ -130,7 +130,7 @@ diff --git a/payroll/views/hr_payslip_views.xml b/payroll/views/hr_payslip_views.xml index 1ac58210..e6215c8c 100644 --- a/payroll/views/hr_payslip_views.xml +++ b/payroll/views/hr_payslip_views.xml @@ -111,7 +111,7 @@ string="Cancel Payslip" name="action_payslip_cancel" type="object" - attrs="{'invisible': ['|', ('state', '!=', 'done'), ('allow_cancel_payslips', '=', False)]}" + invisible="state != 'done' or not allow_cancel_payslips" />