From 392f6f2b2bbb49a8a55b94510d51fa789b20a127 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 9 Aug 2019 14:28:14 +0000 Subject: [PATCH] [FIX] purchase: default user_id on bill - Create a PO, change the Purchase Representative (`user_id`) - Create the corresponding vendor bill The `user_id` of the PO is not transferred to the invoice. There is no reason to not keep the value. opw-2046963 closes odoo/odoo#35611 Signed-off-by: Nicolas Martinelli (nim) --- addons/purchase/models/purchase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index d083ad98af7..021d4d4ca7f 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -404,6 +404,8 @@ class PurchaseOrder(models.Model): 'default_company_id': self.company_id.id, 'company_id': self.company_id.id } + if self.user_id: + result['context']['default_user_id'] = self.user_id.id # choose the view_mode accordingly if len(self.invoice_ids) > 1 and not create_bill: result['domain'] = "[('id', 'in', " + str(self.invoice_ids.ids) + ")]"