From 049175d9bcff049a8a859f77d4fba5a21a495bb3 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Thu, 28 Sep 2023 09:31:51 +0200 Subject: [PATCH] [IMP] stock_release_channel_process_end_time: Rename configuration parameter --- .../models/res_config_settings.py | 21 ++++++++++--------- .../models/stock_picking.py | 4 +++- .../tests/test_release_end_date.py | 3 ++- .../views/res_config_settings.xml | 11 ++++++---- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/stock_release_channel_process_end_time/models/res_config_settings.py b/stock_release_channel_process_end_time/models/res_config_settings.py index 05f87c77bec..d4354a6df04 100644 --- a/stock_release_channel_process_end_time/models/res_config_settings.py +++ b/stock_release_channel_process_end_time/models/res_config_settings.py @@ -1,14 +1,15 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. +# Copyright 2023 Trobz +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import api, fields, models, SUPERUSER_ID, _ -from odoo.exceptions import UserError +from odoo import fields, models class ResConfigSettings(models.TransientModel): - _inherit = 'res.config.settings' - - update_scheduled_date = fields.Boolean( - help="Will update scheduled date of picking based on process end date(time).", - config_parameter='stock_release_channel_process_end_time.update_scheduled_date' - ) \ No newline at end of file + _inherit = "res.config.settings" + + stock_release_use_channel_end_date = fields.Boolean( + help="Will update scheduled date of picking based on process end date " + "instead of release date + delay.", + config_parameter="stock_release_channel_process_end_time." + "stock_release_use_channel_end_date", + ) diff --git a/stock_release_channel_process_end_time/models/stock_picking.py b/stock_release_channel_process_end_time/models/stock_picking.py index c57a0ca069a..7d5c8552b28 100644 --- a/stock_release_channel_process_end_time/models/stock_picking.py +++ b/stock_release_channel_process_end_time/models/stock_picking.py @@ -64,7 +64,9 @@ def _after_release_set_expected_date(self): enabled_update_scheduled_date = bool( self.env["ir.config_parameter"] .sudo() - .get_param("stock_release_channel_process_end_time.update_scheduled_date") + .get_param( + "stock_release_channel_process_end_time.stock_release_use_channel_end_date" + ) ) res = super()._after_release_set_expected_date() for rec in self: diff --git a/stock_release_channel_process_end_time/tests/test_release_end_date.py b/stock_release_channel_process_end_time/tests/test_release_end_date.py index e2bd038fc66..c3c88521c8f 100644 --- a/stock_release_channel_process_end_time/tests/test_release_end_date.py +++ b/stock_release_channel_process_end_time/tests/test_release_end_date.py @@ -63,7 +63,8 @@ def test_channel_end_date_manual(self): @freeze_time("2023-01-27 10:00:00") def test_picking_scheduled_date(self): self.env["ir.config_parameter"].sudo().set_param( - "stock_release_channel_process_end_time.update_scheduled_date", True + "stock_release_channel_process_end_time.stock_release_use_channel_end_date", + True, ) # Remove existing jobs as some already exists to assign pickings to channel jobs_before = self.env["queue.job"].search([]) diff --git a/stock_release_channel_process_end_time/views/res_config_settings.xml b/stock_release_channel_process_end_time/views/res_config_settings.xml index 1162b49968b..795efedbd03 100644 --- a/stock_release_channel_process_end_time/views/res_config_settings.xml +++ b/stock_release_channel_process_end_time/views/res_config_settings.xml @@ -8,13 +8,16 @@
-
+
- +
-