From 5fce7847e116014167ef9cfaf247d29e5556beff Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Wed, 17 Aug 2016 11:46:30 +0200 Subject: [PATCH] [FIX] purchase: fiscal position in multi-company environments Properties depends on with which companies the records are browsed. When retrieving the fiscal position as sudo (from a cron), we should force the company from the context. After https://github.com/odoo/odoo/commit/4162b8f as the context is force in get_fiscal_position, we should call this method with a company (and not pass the company in the context). This has been forgot in https://github.com/odoo/odoo/commit/fe92dea opw-684802 --- addons/purchase/purchase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index ed8026af046..98e17b136f3 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1483,7 +1483,7 @@ class procurement_order(osv.osv): taxes_ids = procurement.product_id.supplier_taxes_id taxes_ids = taxes_ids.filtered(lambda x: x.company_id.id == procurement.company_id.id) # It is necessary to have the appropriate fiscal position to get the right tax mapping - fp = acc_pos_obj.get_fiscal_position(cr, uid, None, partner.id, context=dict(context, company_id=procurement.company_id.id)) + fp = acc_pos_obj.get_fiscal_position(cr, uid, procurement.company_id.id, partner.id, context=context) if fp: fp = acc_pos_obj.browse(cr, uid, fp, context=context) taxes = acc_pos_obj.map_tax(cr, uid, fp, taxes_ids, context=context) @@ -1689,7 +1689,7 @@ class procurement_order(osv.osv): name = seq_obj.next_by_code(cr, uid, 'purchase.order', context=context) or _('PO: %s') % procurement.name gpo = procurement.rule_id.group_propagation_option group = (gpo == 'fixed' and procurement.rule_id.group_id.id) or (gpo == 'propagate' and procurement.group_id.id) or False - fp = acc_pos_obj.get_fiscal_position(cr, uid, None, partner.id, context=dict(context or {}, company_id=procurement.company_id.id)) + fp = acc_pos_obj.get_fiscal_position(cr, uid, procurement.company_id.id, partner.id, context=context) po_vals = { 'name': name, 'origin': procurement.origin,