From 72ea4d57d2ba5161270e2bfbd4ace6d2f89cdbfb Mon Sep 17 00:00:00 2001 From: PNO Date: Fri, 15 Jul 2022 07:25:29 +0000 Subject: [PATCH] [FIX] mrp: Wrong replenishment order notification On the commit 69dcdd4, the order='create_date desc' was removed and the way of getting the MO for the notification changed. Now, the context is used, it should be written_after instead of written_date. In addition, the now declaration should be at the beginning of the method action_replenish. (The MO created is correct, only the notification is wrong) Should be forwarded OPW-2877457 closes odoo/odoo#96986 X-original-commit: 029da238a2baaf59bdf9ae828a4739ee4a9f3ede Signed-off-by: William Henrotin (whe) --- addons/stock/models/stock_orderpoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_orderpoint.py b/addons/stock/models/stock_orderpoint.py index 3b0e03537f0..233489f0c15 100644 --- a/addons/stock/models/stock_orderpoint.py +++ b/addons/stock/models/stock_orderpoint.py @@ -213,6 +213,7 @@ class StockWarehouseOrderpoint(models.Model): return action def action_replenish(self): + now = datetime.now() try: self._procure_orderpoint_confirm(company_id=self.env.company) except UserError as e: @@ -226,7 +227,6 @@ class StockWarehouseOrderpoint(models.Model): 'views': [(self.env.ref('product.product_normal_form_view').id, 'form')], 'context': {'form_view_initial_mode': 'edit'} }, _('Edit Product')) - now = datetime.now() notification = False if len(self) == 1: notification = self.with_context(written_after=now)._get_replenishment_order_notification()