[FIX]: small fix for voucher

bzr revid: mga@tinyerp.com-20100913190526-bthhlea1qbjljvds
This commit is contained in:
Mantavya Gajjar 2010-09-14 00:35:26 +05:30
parent 9c38edb4e9
commit 4ff1c93a9c
2 changed files with 2 additions and 10 deletions

View File

@ -281,17 +281,14 @@ class account_voucher(osv.osv):
journal = journal_pool.browse(cr, uid, journal_id)
partner = partner_pool.browse(cr, uid, partner_id)
account_id = False
term_id = False
if journal.type in ('sale','sale_refund'):
account_id = partner.property_account_receivable.id
elif journal.type in ('purchase', 'purchase_refund','expense'):
account_id = partner.property_account_payable.id
else:
account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
default['value'].update({
'account_id':account_id,
'term_id':term_id
})
default['value']['account_id'] = account_id
if journal.type not in ('cash', 'bank'):
return default
@ -354,7 +351,6 @@ class account_voucher(osv.osv):
default['value']['pre_line'] = 1
elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0:
default['value']['pre_line'] = 1
return default
def onchange_date(self, cr, user, ids, date, context={}):

View File

@ -18,9 +18,7 @@
<field name="reference" select="1" string="Payment Ref"/>
<field name="name" colspan="4"/>
<field name="account_id"
domain="[('type','=','other')]"
widget="selection"
on_change="onchange_account(account_id)"
invisible="True"/>
<field name="pre_line" invisible="1"/>
<field name="type" invisible="True"/>
@ -115,9 +113,7 @@
<field name="reference" select="1" string="Payment Ref"/>
<field name="name" colspan="4"/>
<field name="account_id"
domain="[('type','=','other')]"
widget="selection"
on_change="onchange_account(account_id)"
invisible="True"/>
<field name="pre_line" invisible="1"/>
<field name="type" invisible="True"/>