[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.
(The MO created is correct, only the notification is wrong)

OPW-2877457

closes odoo/odoo#96856

X-original-commit: b80287b265a4c01babedcbb58459c35d36a48066
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
PNO
2022-07-28 05:04:26 +02:00
parent 13245211a1
commit 33ed562cab
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ class StockWarehouseOrderpoint(models.Model):
def _get_replenishment_order_notification(self):
self.ensure_one()
domain = [('orderpoint_id', 'in', self.ids)]
if self.env.context.get('written_date'):
if self.env.context.get('written_after'):
domain = AND([domain, [('write_date', '>', self.env.context.get('written_after'))]])
production = self.env['mrp.production'].search(domain, limit=1)
if production:
+1 -1
View File
@@ -279,7 +279,7 @@ class Orderpoint(models.Model):
def _get_replenishment_order_notification(self):
self.ensure_one()
domain = [('orderpoint_id', 'in', self.ids)]
if self.env.context.get('written_date'):
if self.env.context.get('written_after'):
domain = AND([domain, [('write_date', '>', self.env.context.get('written_after'))]])
order = self.env['purchase.order.line'].search(domain, limit=1).order_id
if order:
+1 -1
View File
@@ -455,7 +455,7 @@ class StockWarehouseOrderpoint(models.Model):
def _get_replenishment_order_notification(self):
self.ensure_one()
domain = [('orderpoint_id', 'in', self.ids)]
if self.env.context.get('written_date'):
if self.env.context.get('written_after'):
domain = expression.AND([domain, [('write_date', '>', self.env.context.get('written_after'))]])
move = self.env['stock.move'].search(domain, limit=1)
if move.picking_id: