[FIX]account_voucher: do not set account_id to False during onchanges

bzr revid: dle@openerp.com-20140212173711-nvx2gt1bboyey4qg
This commit is contained in:
Denis Ledoux 2014-02-12 18:37:11 +01:00
parent 0c122c32ce
commit 1e21c3ea11
1 changed files with 7 additions and 5 deletions

View File

@ -920,9 +920,10 @@ class account_voucher(osv.osv):
if context.get('payment_expected_currency') and currency_id != context.get('payment_expected_currency'):
vals['value']['amount'] = 0
amount = 0
res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context)
for key in res.keys():
vals[key].update(res[key])
if partner_id:
res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context)
for key in res.keys():
vals[key].update(res[key])
return vals
def button_proforma_voucher(self, cr, uid, ids, context=None):
@ -979,7 +980,7 @@ class account_voucher(osv.osv):
res = {}
if not partner_id:
return res
res = {'account_id':False}
res = {}
partner_pool = self.pool.get('res.partner')
journal_pool = self.pool.get('account.journal')
if pay_now == 'pay_later':
@ -991,7 +992,8 @@ class account_voucher(osv.osv):
account_id = partner.property_account_payable.id
else:
account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
res['account_id'] = account_id
if account_id:
res['account_id'] = account_id
return {'value':res}
def _sel_context(self, cr, uid, voucher_id, context=None):