[IMP] purchase: fiscal positions
Automatic detection of a fiscal position is now working for Purchase. opw:631554
This commit is contained in:
parent
622e00baa5
commit
1062905acb
|
@ -397,11 +397,16 @@ class purchase_order(osv.osv):
|
|||
'fiscal_position': False,
|
||||
'payment_term_id': False,
|
||||
}}
|
||||
|
||||
company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
|
||||
if not company_id:
|
||||
raise osv.except_osv(_('Error!'), _('There is no default company for the current user!'))
|
||||
fp = self.pool['account.fiscal.position'].get_fiscal_position(cr, uid, company_id, partner_id, context=context)
|
||||
supplier_address = partner.address_get(cr, uid, [partner_id], ['default'], context=context)
|
||||
supplier = partner.browse(cr, uid, partner_id, context=context)
|
||||
return {'value': {
|
||||
'pricelist_id': supplier.property_product_pricelist_purchase.id,
|
||||
'fiscal_position': supplier.property_account_position and supplier.property_account_position.id or False,
|
||||
'fiscal_position': fp or supplier.property_account_position and supplier.property_account_position.id,
|
||||
'payment_term_id': supplier.property_supplier_payment_term.id or False,
|
||||
}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue