From 14b060ed71c7486828a5a872d063e84723845e05 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Fri, 18 Sep 2015 13:59:18 +0200 Subject: [PATCH] [FIX] purchase: journal_id in auto procurement The journal_id used in a purchase.order created in auto procurement (by the function make_po) must be the journal_id of the company_id set on the procurement. The company_id set on the procurement is the company_id set on the SO (function _prepare_order_line_procurement). When creating the PO in function make_po, the company_id must be set in the context to use the right journal_id with the function _get_journal in "purchase.order" model. opw:648600 --- addons/purchase/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 32cf2e5ba90..c0c3e2845ba 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1537,7 +1537,7 @@ class procurement_order(osv.osv): 'payment_term_id': partner.property_supplier_payment_term.id or False, 'dest_address_id': procurement.partner_dest_id.id, } - po_id = self.create_procurement_purchase_order(cr, SUPERUSER_ID, procurement, po_vals, line_vals, context=context) + po_id = self.create_procurement_purchase_order(cr, SUPERUSER_ID, procurement, po_vals, line_vals, context=dict(context, company_id=po_vals['company_id'])) po_line_id = po_obj.browse(cr, uid, po_id, context=context).order_line[0].id pass_ids.append(procurement.id) res[procurement.id] = po_line_id