diff --git a/openupgrade_scripts/apriori.py b/openupgrade_scripts/apriori.py index f5d856c8f42f..ae4d1427d281 100644 --- a/openupgrade_scripts/apriori.py +++ b/openupgrade_scripts/apriori.py @@ -39,6 +39,8 @@ "website_sale_stock_product_configurator": "website_sale_product_configurator", # OCA/account-invoicing "account_invoice_fiscal_position_update": "account", + # OCA/hr-attendance + "hr_attendance_geolocation": "hr_attendance", # OCA/l10n-spain "l10n_es_irnr": "l10n_es", "l10n_es_irnr_sii": "l10n_es_aeat_sii_oca", diff --git a/openupgrade_scripts/scripts/hr_attendance/17.0.2.0/pre-migration.py b/openupgrade_scripts/scripts/hr_attendance/17.0.2.0/pre-migration.py index 58cc8a1e5cf9..43b5948096a9 100644 --- a/openupgrade_scripts/scripts/hr_attendance/17.0.2.0/pre-migration.py +++ b/openupgrade_scripts/scripts/hr_attendance/17.0.2.0/pre-migration.py @@ -1,4 +1,5 @@ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com) +# Copyright 2024 Tecnativa - Víctor Martínez # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from openupgradelib import openupgrade @@ -14,6 +15,40 @@ ] +def _hr_attendance_geolocation(env): + """Rename the fields if the hr_attendance_geolocation module was installed.""" + if openupgrade.column_exists(env.cr, "hr_attendance", "check_in_latitude"): + openupgrade.rename_fields( + env, + [ + ( + "hr.attendance", + "hr_attendance", + "check_in_latitude", + "in_latitude", + ), + ( + "hr.attendance", + "hr_attendance", + "check_in_longitude", + "in_longitude", + ), + ( + "hr.attendance", + "hr_attendance", + "check_out_latitude", + "out_latitude", + ), + ( + "hr.attendance", + "hr_attendance", + "check_out_longitude", + "out_longitude", + ), + ], + ) + + def pre_create_hr_attendance_overtime_hours(env): openupgrade.logged_query( env.cr, @@ -42,5 +77,6 @@ def fill_res_company_attendance_from_systray(env): @openupgrade.migrate() def migrate(env, version): openupgrade.rename_xmlids(env.cr, _xmlid_renames) + _hr_attendance_geolocation(env) pre_create_hr_attendance_overtime_hours(env) fill_res_company_attendance_from_systray(env)