From 02942f318e3bc629de7c86818e18ae0899b9d929 Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Tue, 15 Jan 2019 12:15:07 +0100 Subject: [PATCH] [11.0][FIX] stock_orderpoint_manual_procurement: pass requested_uid in context to be able to have it through a chain of procuremets. --- .../wizards/make_procurement_orderpoint.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py b/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py index 0bce7f860..8241eee85 100644 --- a/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py +++ b/stock_orderpoint_manual_procurement/wizards/make_procurement_orderpoint.py @@ -61,6 +61,10 @@ class MakeProcurementOrderpoint(models.TransientModel): def make_procurement(self): self.ensure_one() errors = [] + # User requesting the procurement is passed by context to be able to + # update final MO, PO or trasfer with that information. + pg_obj = self.env['procurement.group'].with_context( + requested_uid=self.env.user) for item in self.item_ids: if not item.qty: raise ValidationError(_("Quantity must be positive.")) @@ -69,10 +73,9 @@ class MakeProcurementOrderpoint(models.TransientModel): values = item.orderpoint_id._prepare_procurement_values(item.qty) values['date_planned'] = fields.Datetime.to_string( fields.Date.from_string(item.date_planned)) - values['requested_uid'] = self.env.user # Run procurement try: - self.env['procurement.group'].run( + pg_obj.run( item.orderpoint_id.product_id, item.qty, item.uom_id,