From aede150c10fa6c95b52865953c6a910e20e68047 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Sat, 14 Aug 2010 13:23:03 +0530 Subject: [PATCH] [IMP]: improve voucher module improve workflow [FIX]: fix a problem of voucher calculations bzr revid: mga@tinyerp.com-20100814075303-snt0eu35812nize0 --- addons/account/demo/account_minimal.xml | 2 +- .../account_voucher/test/account_voucher.yml | 2 +- addons/account_voucher/voucher.py | 10 ++-- addons/account_voucher/voucher_view.xml | 8 +-- addons/account_voucher/voucher_workflow.xml | 49 ++++++++++--------- 5 files changed, 38 insertions(+), 33 deletions(-) diff --git a/addons/account/demo/account_minimal.xml b/addons/account/demo/account_minimal.xml index df43c81b3b7..85bfedb6809 100644 --- a/addons/account/demo/account_minimal.xml +++ b/addons/account/demo/account_minimal.xml @@ -398,7 +398,7 @@ Cash Journal - (test) - CHK + CSH cash diff --git a/addons/account_voucher/test/account_voucher.yml b/addons/account_voucher/test/account_voucher.yml index a49222c3b96..88f8285458f 100644 --- a/addons/account_voucher/test/account_voucher.yml +++ b/addons/account_voucher/test/account_voucher.yml @@ -23,7 +23,7 @@ !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}: - state == 'draft' - - I change the state of voucher to "proforma" by clicking PRO-FORMA button + I compute the voucher to calculate the taxes by clicking Cpmpute button - !workflow {model: account.voucher, action: open_voucher, ref: account_voucher_voucherforaxelor0} - diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index 3bf9453b453..22d2c72c2c1 100644 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -137,7 +137,7 @@ class account_voucher(osv.osv): 'move_ids': fields.related('move_id','line_id', type='many2many', relation='account.move.line', string='Real Entry'), #'move_ids':fields.many2many('account.move.line', 'voucher_id', 'account_id', 'rel_account_move', 'Real Entry', readonly=True, states={'draft':[('readonly',False)]}), 'partner_id':fields.many2one('res.partner', 'Partner', readonly=True, states={'draft':[('readonly',False)]}), - 'audit':fields.boolean('Audit Complete ?', required=False), + 'audit': fields.related('move_id','to_check', type='boolean', relation='account.move', string='Audit Complete ?'), } _defaults = { @@ -292,14 +292,18 @@ class account_voucher(osv.osv): if total != 0: res = { - 'amount':total, - 'state':'proforma' + 'amount':total } self.write(dbcr, uid, ids, res) else: raise osv.except_osv(_('Invalid amount !'), _('You can not create Pro-Forma voucher with Total amount <= 0 !')) return True + def voucher_recheck(self, cr, uid, ids, context={}): + self.open_voucher(cr, uid, ids, context) + self.write(cr, uid, ids, {'state':'recheck'}, context) + return True + def proforma_voucher(self, cr, uid, ids, context={}): self.action_move_line_create(cr, uid, ids) self.write(cr, uid, ids, {'state':'posted'}) diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml index 780d20d3ebb..44aba92934c 100644 --- a/addons/account_voucher/voucher_view.xml +++ b/addons/account_voucher/voucher_view.xml @@ -70,11 +70,11 @@ -