[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
This commit is contained in:
Goffin Simon 2015-09-18 13:59:18 +02:00
parent 16fda32a0e
commit 14b060ed71
1 changed files with 1 additions and 1 deletions

View File

@ -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