[FIX] account_voucher: correct red fields..error when default account not set on journal

bzr revid: ara@tinyerp.com-20110420060717-2wm93bmrbm35333i
This commit is contained in:
ARA (OpenERP) 2011-04-20 11:37:17 +05:30
parent 537acc4dc4
commit c71cc3e686
1 changed files with 2 additions and 0 deletions

View File

@ -379,6 +379,8 @@ class account_voucher(osv.osv):
account_id = partner.property_account_payable.id
tr_type = 'purchase'
else:
if not journal.default_credit_account_id or not journal.default_debit_account_id:
raise osv.except_osv(_('Error !'), _('Please define default credit/debit account on the %s !') % (journal.name))
account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
tr_type = 'receipt'