Skip to content
Snippets Groups Projects
Commit eabf5cc1 authored by PNO's avatar PNO
Browse files

[FIX] mrp: Wrong replenishment order notification


On the commit 69dcdd41, 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#96821

X-original-commit: b80287b2
Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 8b7d548c
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,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:
......
......@@ -258,7 +258,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:
......
......@@ -446,7 +446,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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment