From 01e14fba9379b95c2611a523748148d3c43a32ea Mon Sep 17 00:00:00 2001 From: Alessio Renda Date: Mon, 23 Oct 2023 10:10:09 +0200 Subject: [PATCH] [FIX] hr_payroll_period: remove warnings --- .../migrations/14.0.1.0.0/pre-migration.py | 11 +++++++++++ hr_payroll_period/models/hr_contract.py | 4 +--- hr_payroll_period/models/hr_employee.py | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 hr_payroll_period/migrations/14.0.1.0.0/pre-migration.py diff --git a/hr_payroll_period/migrations/14.0.1.0.0/pre-migration.py b/hr_payroll_period/migrations/14.0.1.0.0/pre-migration.py new file mode 100644 index 00000000..b80ed9f8 --- /dev/null +++ b/hr_payroll_period/migrations/14.0.1.0.0/pre-migration.py @@ -0,0 +1,11 @@ +from odoo.tools.sql import column_exists, rename_column + + +def migrate(cr, version): + if column_exists(cr, "hr_contract", "shedule_pay"): + rename_column( + cr, + "hr_contract", + "shedule_pay", + "schedule_pay", + ) diff --git a/hr_payroll_period/models/hr_contract.py b/hr_payroll_period/models/hr_contract.py index cf095f19..3386c47e 100644 --- a/hr_payroll_period/models/hr_contract.py +++ b/hr_payroll_period/models/hr_contract.py @@ -11,6 +11,4 @@ class HrContract(models.Model): _inherit = "hr.contract" # Add semi-monthly to payroll schedules - schedule_pay = fields.Selection( - get_schedules, "Scheduled Pay", oldname="shedule_pay", index=True - ) + schedule_pay = fields.Selection(get_schedules, "Scheduled Pay", index=True) diff --git a/hr_payroll_period/models/hr_employee.py b/hr_payroll_period/models/hr_employee.py index 150263b9..975a9137 100644 --- a/hr_payroll_period/models/hr_employee.py +++ b/hr_payroll_period/models/hr_employee.py @@ -7,7 +7,7 @@ class HrEmployee(models.AbstractModel): _inherit = "hr.employee.base" - contract_id = fields.Many2one(search="_search_contract") + contract_id = fields.Many2one(comodel_name="hr.contract", search="_search_contract") @api.model def _search_contract(self, operator, value):