[FIX] account: change delivery address

The default fiscal position on sale order, is set according to[by priority]:
[1] the delivery
[2] the partner

opw:641883
This commit is contained in:
Goffin Simon 2015-06-19 14:31:41 +02:00
parent 9ef5e40278
commit 5fcf0f5a6f
1 changed files with 4 additions and 4 deletions

View File

@ -113,16 +113,16 @@ class account_fiscal_position(osv.osv):
part_obj = self.pool['res.partner']
partner = part_obj.browse(cr, uid, partner_id, context=context)
# partner manually set fiscal position always win
if partner.property_account_position:
return partner.property_account_position.id
# if no delivery use invocing
if delivery_id:
delivery = part_obj.browse(cr, uid, delivery_id, context=context)
else:
delivery = partner
# partner manually set fiscal position always win
if delivery.property_account_position or partner.property_account_position:
return delivery.property_account_position or partner.property_account_position
domains = [[('auto_apply', '=', True), ('vat_required', '=', partner.vat_subjected)]]
if partner.vat_subjected:
# Possibly allow fallback to non-VAT positions, if no VAT-required position matches