[FIX] account: account_move_line: improved account selection when partner changes

lp bug: https://launchpad.net/bugs/784006 fixed

bzr revid: ara@tinyerp.com-20110606053015-2uczs37n3gx0ftc6
This commit is contained in:
ARA (OpenERP) 2011-06-06 11:00:15 +05:30
parent 552afb10c5
commit 18d848b45c
1 changed files with 6 additions and 1 deletions

View File

@ -650,8 +650,13 @@ class account_move_line(osv.osv):
#if jt in ('sale', 'purchase_refund', 'bank', 'cash'):
if jt in ('sale', 'purchase_refund'):
val['account_id'] = fiscal_pos_obj.map_account(cr, uid, part and part.property_account_position or False, id2)
elif jt in ('purchase', 'sale_refund', 'expense', 'bank', 'cash'):
elif jt in ('purchase', 'sale_refund'):
val['account_id'] = fiscal_pos_obj.map_account(cr, uid, part and part.property_account_position or False, id1)
elif jt in ('general', 'bank', 'cash'):
if part.customer and not part.supplier:
val['account_id'] = fiscal_pos_obj.map_account(cr, uid, part and part.property_account_position or False, id2)
else:
val['account_id'] = fiscal_pos_obj.map_account(cr, uid, part and part.property_account_position or False, id1)
if val.get('account_id', False):
d = self.onchange_account_id(cr, uid, ids, val['account_id'])
val.update(d['value'])