From 99ed5cbe7b5aec475044e8ec3130bf287fe52981 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Thu, 14 Oct 2010 11:39:17 +0530 Subject: [PATCH] [IMP] account_voucher: raise warning if no account base code and account tax code on tax is defined bzr revid: psi@tinyerp.co.in-20101014060917-ns2nys2ixk604k5t --- addons/account_voucher/account_voucher.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 62d274a9c3a..6991aa8e859 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -574,6 +574,7 @@ class account_voucher(osv.osv): move_line_pool = self.pool.get('account.move.line') currency_pool = self.pool.get('res.currency') bank_st_line_obj = self.pool.get('account.bank.statement.line') + tax_obj = self.pool.get('account.tax') for inv in self.browse(cr, uid, ids): if inv.move_id: continue @@ -679,7 +680,10 @@ class account_voucher(osv.osv): move_line.update({ 'account_tax_id':inv.tax_id.id, }) - + if move_line.get('account_tax_id', False): + tax_id = tax_obj.browse(cr, uid, [move_line['account_tax_id']], context=context)[0] + if not (tax_id.base_code_id and tax_id.tax_code_id): + raise osv.except_osv(_('No Account Base Code and Account Tax Code!'),_("You have to define account base code and account tax code on the '%s' tax!") % (tax_id.name)) master_line = move_line_pool.create(cr, uid, move_line) if line.move_line_id.id: rec_ids = [master_line, line.move_line_id.id]