From 4736e83e8aca2634fe6c06a7db1462cefd5fbf8e Mon Sep 17 00:00:00 2001 From: Majda EL MARIOULI Date: Thu, 31 Oct 2024 05:00:17 -0400 Subject: [PATCH] TA#70572 [IMP] stock_orderpoint_scheduled_date (#189) --- Dockerfile | 2 -- stock_orderpoint_scheduled_date/__manifest__.py | 2 +- .../models/stock_warehouse_orderpoint.py | 15 +++++++++++---- .../views/stock_orderpoint_views.xml | 2 ++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 36b39d4..1ee240f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,6 @@ RUN mkdir -p "${THIRD_PARTY_ADDONS}" && chown -R odoo "${THIRD_PARTY_ADDONS}" COPY ./gitoo.yml /gitoo.yml RUN gitoo install-all --conf_file /gitoo.yml --destination "${THIRD_PARTY_ADDONS}" -USER odoo - COPY product_category_safe_change /mnt/extra-addons/product_category_safe_change COPY product_packaging_dimension_decimal /mnt/extra-addons/product_packaging_dimension_decimal diff --git a/stock_orderpoint_scheduled_date/__manifest__.py b/stock_orderpoint_scheduled_date/__manifest__.py index 9c415af..fc69dbc 100755 --- a/stock_orderpoint_scheduled_date/__manifest__.py +++ b/stock_orderpoint_scheduled_date/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Stock Orderpoint Scheduled Date", "summary": "Force Scheduled Date in Stock Orderpoint", - "version": "14.0.1.0.0", + "version": "14.0.1.1.0", "category": "stock", "website": "https://bit.ly/numigi-com", "author": "Numigi", diff --git a/stock_orderpoint_scheduled_date/models/stock_warehouse_orderpoint.py b/stock_orderpoint_scheduled_date/models/stock_warehouse_orderpoint.py index 479b522..9c93f68 100755 --- a/stock_orderpoint_scheduled_date/models/stock_warehouse_orderpoint.py +++ b/stock_orderpoint_scheduled_date/models/stock_warehouse_orderpoint.py @@ -8,15 +8,20 @@ class stockWarehouseOrderpoint(models.Model): _inherit = "stock.warehouse.orderpoint" scheduled_date = fields.Date("Scheduled Date") + previous_scheduled_date = fields.Date( + "Previous Scheduled Date", default=fields.Date.today() + ) @api.depends('rule_ids', 'product_id.seller_ids', 'product_id.seller_ids.delay', 'scheduled_date') def _compute_lead_days(self): for orderpoint in self.with_context(bypass_delay_description=True): - if not orderpoint.scheduled_date: - return super(stockWarehouseOrderpoint, orderpoint)._compute_lead_days() - else: + if orderpoint.scheduled_date: orderpoint.lead_days_date = orderpoint.scheduled_date + elif orderpoint.previous_scheduled_date: + orderpoint.lead_days_date = orderpoint.previous_scheduled_date + else: + super(stockWarehouseOrderpoint, orderpoint)._compute_lead_days() def open_set_schedule_date_wizard(self): wizard = self.env['stock.warehouse.orderpoint.schedule.date'].create({}) @@ -28,5 +33,7 @@ def open_set_schedule_date_wizard(self): def action_replenish(self): result = super(stockWarehouseOrderpoint, self).action_replenish() - self.write({"scheduled_date": False}) + self.write( + {"previous_scheduled_date": self.scheduled_date, "scheduled_date": False} + ) return result diff --git a/stock_orderpoint_scheduled_date/views/stock_orderpoint_views.xml b/stock_orderpoint_scheduled_date/views/stock_orderpoint_views.xml index e22f976..69b6a01 100644 --- a/stock_orderpoint_scheduled_date/views/stock_orderpoint_views.xml +++ b/stock_orderpoint_scheduled_date/views/stock_orderpoint_views.xml @@ -7,6 +7,7 @@ + @@ -17,6 +18,7 @@ +