From 95009df779455461967e0e7b810704eed2ec82bc Mon Sep 17 00:00:00 2001 From: sunjie Date: Fri, 15 Aug 2025 12:16:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9B=B4=E6=96=B0=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_hr_attendance/__init__.py | 2 +- yuthon_hr_attendance/__manifest__.py | 3 ++- .../migrations/17.0.3.1/end-migrate.py | 13 +++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 yuthon_hr_attendance/migrations/17.0.3.1/end-migrate.py diff --git a/yuthon_hr_attendance/__init__.py b/yuthon_hr_attendance/__init__.py index e0eb6e53b..f4bb00c04 100644 --- a/yuthon_hr_attendance/__init__.py +++ b/yuthon_hr_attendance/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- - from . import controllers from . import models from . import wizard + diff --git a/yuthon_hr_attendance/__manifest__.py b/yuthon_hr_attendance/__manifest__.py index d99e63101..28601feaa 100644 --- a/yuthon_hr_attendance/__manifest__.py +++ b/yuthon_hr_attendance/__manifest__.py @@ -8,7 +8,7 @@ 'description': ''' ''', 'author': 'pengyuthon', - 'version': '17.0.1.2.1', + 'version': '3.1', 'category': 'Human Resources/Attendances', 'sequence': 240, 'website': 'https://www.pengyuthon.com', @@ -83,5 +83,6 @@ }, 'installable': True, 'application': True, + 'post_init_hook':'recompute_my_model_fields', 'license': 'LGPL-3', } diff --git a/yuthon_hr_attendance/migrations/17.0.3.1/end-migrate.py b/yuthon_hr_attendance/migrations/17.0.3.1/end-migrate.py new file mode 100644 index 000000000..08bffe2a4 --- /dev/null +++ b/yuthon_hr_attendance/migrations/17.0.3.1/end-migrate.py @@ -0,0 +1,13 @@ +# migrations/17.0.1.1/post-migration.py +import logging + +from odoo import api, SUPERUSER_ID + +_logger = logging.getLogger(__name__) + +def migrate(cr, version): + env = api.Environment(cr, SUPERUSER_ID, {}) + records = env['planning.slot'].search([]) + _logger.info(f'更新模块planning.slot的display_name字段') + if records: + records._compute_display_name() \ No newline at end of file