diff --git a/stock_release_channel_shipment_advice_process_end_time/__manifest__.py b/stock_release_channel_shipment_advice_process_end_time/__manifest__.py index 57fa68fb65..1faa78b89d 100644 --- a/stock_release_channel_shipment_advice_process_end_time/__manifest__.py +++ b/stock_release_channel_shipment_advice_process_end_time/__manifest__.py @@ -3,8 +3,9 @@ { "name": "Stock Release Channel Shipment Advice Process End Time", - "summary": """ - c""", + "summary": """This module allows to set a delay time (in minutes) between the + release channel process end time and the shipment advice arrival to the dock time. + """, "version": "16.0.1.0.0", "license": "AGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", diff --git a/stock_release_channel_shipment_advice_process_end_time/models/res_company.py b/stock_release_channel_shipment_advice_process_end_time/models/res_company.py index dbe88a7ec2..f6ba487ca3 100644 --- a/stock_release_channel_shipment_advice_process_end_time/models/res_company.py +++ b/stock_release_channel_shipment_advice_process_end_time/models/res_company.py @@ -8,4 +8,7 @@ class ResCompany(models.Model): _inherit = "res.company" - release_channel_process_end_time_delay = fields.Integer() + release_channel_shipment_advice_arrival_delay = fields.Integer( + help="Global default value for the delay between the release channel process " + "end time and the arrival of shipments to the dock." + ) diff --git a/stock_release_channel_shipment_advice_process_end_time/models/res_config_settings.py b/stock_release_channel_shipment_advice_process_end_time/models/res_config_settings.py index e268f74968..5229239769 100644 --- a/stock_release_channel_shipment_advice_process_end_time/models/res_config_settings.py +++ b/stock_release_channel_shipment_advice_process_end_time/models/res_config_settings.py @@ -8,6 +8,7 @@ class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" - release_channel_process_end_time_delay = fields.Integer( - related="company_id.release_channel_process_end_time_delay", readonly=False + release_channel_shipment_advice_arrival_delay = fields.Integer( + related="company_id.release_channel_shipment_advice_arrival_delay", + readonly=False, ) diff --git a/stock_release_channel_shipment_advice_process_end_time/models/stock_release_channel.py b/stock_release_channel_shipment_advice_process_end_time/models/stock_release_channel.py index f73751a251..3328b5d365 100644 --- a/stock_release_channel_shipment_advice_process_end_time/models/stock_release_channel.py +++ b/stock_release_channel_shipment_advice_process_end_time/models/stock_release_channel.py @@ -9,29 +9,35 @@ class StockReleaseChannel(models.Model): _inherit = "stock.release.channel" - process_end_time_delay = fields.Integer( - compute="_compute_process_end_time_delay", store=True, readonly=False + shipment_advice_arrival_delay = fields.Integer( + compute="_compute_shipment_advice_arrival_delay", + store=True, + readonly=False, + help="The delay between the release channel process end time and the arrival " + "of shipments to the dock.", ) @api.depends("warehouse_id") - def _compute_process_end_time_delay(self): + def _compute_shipment_advice_arrival_delay(self): for rec in self: - if not rec.process_end_time_delay: - rec.process_end_time_delay = ( - rec.warehouse_id.release_channel_process_end_time_delay + if not rec.shipment_advice_arrival_delay: + rec.shipment_advice_arrival_delay = ( + rec.warehouse_id.release_channel_shipment_advice_arrival_delay ) - def _get_process_end_time_delay(self, warehouse): + def _get_shipment_advice_arrival_delay(self, warehouse): self.ensure_one() - if self.process_end_time_delay: - return self.process_end_time_delay + if self.shipment_advice_arrival_delay: + return self.shipment_advice_arrival_delay if not warehouse: return 0 - if warehouse.release_channel_process_end_time_delay: - return warehouse.release_channel_process_end_time_delay - return warehouse.company_id.release_channel_process_end_time_delay + if warehouse.release_channel_shipment_advice_arrival_delay: + return warehouse.release_channel_shipment_advice_arrival_delay + return warehouse.company_id.release_channel_shipment_advice_arrival_delay def _get_shipment_advice_arrival_date(self, warehouse): self.ensure_one() - process_end_time_delay = self._get_process_end_time_delay(warehouse) - return self.process_end_date + timedelta(minutes=process_end_time_delay) + shipment_advice_arrival_delay = self._get_shipment_advice_arrival_delay( + warehouse + ) + return self.process_end_date + timedelta(minutes=shipment_advice_arrival_delay) diff --git a/stock_release_channel_shipment_advice_process_end_time/models/stock_warehouse.py b/stock_release_channel_shipment_advice_process_end_time/models/stock_warehouse.py index 160ac23e1b..6b4b289565 100644 --- a/stock_release_channel_shipment_advice_process_end_time/models/stock_warehouse.py +++ b/stock_release_channel_shipment_advice_process_end_time/models/stock_warehouse.py @@ -8,14 +8,18 @@ class StockWarehouse(models.Model): _inherit = "stock.warehouse" - release_channel_process_end_time_delay = fields.Integer( - compute="_compute_release_channel_end_time_delay", store=True, readonly=False + release_channel_shipment_advice_arrival_delay = fields.Integer( + compute="_compute_release_channel_end_time_delay", + store=True, + readonly=False, + help="Default value for the delay between the release channel process " + "end time and the arrival of shipments to docks of this warehouse.", ) @api.depends("company_id") def _compute_release_channel_end_time_delay(self): for rec in self: - if not rec.release_channel_process_end_time_delay: - rec.release_channel_process_end_time_delay = ( - rec.company_id.release_channel_process_end_time_delay + if not rec.release_channel_shipment_advice_arrival_delay: + rec.release_channel_shipment_advice_arrival_delay = ( + rec.company_id.release_channel_shipment_advice_arrival_delay ) diff --git a/stock_release_channel_shipment_advice_process_end_time/tests/test_stock_release_channel_shipment_advice_process_end_time.py b/stock_release_channel_shipment_advice_process_end_time/tests/test_stock_release_channel_shipment_advice_process_end_time.py index e9d7591037..e3b94f7a7d 100644 --- a/stock_release_channel_shipment_advice_process_end_time/tests/test_stock_release_channel_shipment_advice_process_end_time.py +++ b/stock_release_channel_shipment_advice_process_end_time/tests/test_stock_release_channel_shipment_advice_process_end_time.py @@ -29,9 +29,9 @@ def test_plan_shipment_simple_delay_on_company_arrival_date(self): - warehouse: 0mn - channel: 0mn """ - self.wh.company_id.release_channel_process_end_time_delay = 10 - self.wh.release_channel_process_end_time_delay = 0 - self.channel.process_end_time_delay = 0 + self.wh.company_id.release_channel_shipment_advice_arrival_delay = 10 + self.wh.release_channel_shipment_advice_arrival_delay = 0 + self.channel.shipment_advice_arrival_delay = 0 self.channel.button_plan_shipments() shipment_advice = self.channel.shipment_advice_ids @@ -46,9 +46,9 @@ def test_plan_shipment_simple_delay_on_warehouse_arrival_date(self): - warehouse: 20mn - channel: 0mn """ - self.wh.company_id.release_channel_process_end_time_delay = 10 - self.wh.release_channel_process_end_time_delay = 20 - self.channel.process_end_time_delay = 0 + self.wh.company_id.release_channel_shipment_advice_arrival_delay = 10 + self.wh.release_channel_shipment_advice_arrival_delay = 20 + self.channel.shipment_advice_arrival_delay = 0 self.channel.button_plan_shipments() shipment_advice = self.channel.shipment_advice_ids @@ -63,9 +63,9 @@ def test_plan_shipment_simple_delay_on_channel_arrival_date(self): - warehouse: 20mn - channel: 30mn """ - self.wh.company_id.release_channel_process_end_time_delay = 10 - self.wh.release_channel_process_end_time_delay = 20 - self.channel.process_end_time_delay = 30 + self.wh.company_id.release_channel_shipment_advice_arrival_delay = 10 + self.wh.release_channel_shipment_advice_arrival_delay = 20 + self.channel.shipment_advice_arrival_delay = 30 self.channel.button_plan_shipments() shipment_advice = self.channel.shipment_advice_ids diff --git a/stock_release_channel_shipment_advice_process_end_time/views/res_config_settings.xml b/stock_release_channel_shipment_advice_process_end_time/views/res_config_settings.xml index e0723bcee9..dfc85fca79 100644 --- a/stock_release_channel_shipment_advice_process_end_time/views/res_config_settings.xml +++ b/stock_release_channel_shipment_advice_process_end_time/views/res_config_settings.xml @@ -13,7 +13,9 @@
-