[FIX] account_voucher: remove pay button if payment is done

bzr revid: tpa@tinyerp.com-20120323113925-hftkypiln1rn7mlk
This commit is contained in:
Turkesh Patel (Open ERP) 2012-03-23 17:09:25 +05:30
parent 12381be010
commit 4e0cdb5829
2 changed files with 4 additions and 4 deletions

View File

@ -46,10 +46,10 @@ class account_voucher(osv.osv):
def _check_paid(self, cr, uid, ids, name, args, context=None):
res = {}
for voucher in self.browse(cr, uid, ids, context=context):
ok = True
ok = False
for line in voucher.move_ids:
if (line.account_id.type, 'in', ('receivable', 'payable')) and not line.reconcile_id:
ok = False
if (line.account_id.type, 'in', ('receivable', 'payable')) and line.reconcile_id:
ok = True
res[voucher.id] = ok
return res

View File

@ -153,7 +153,7 @@
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
<button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to confirm this record ?"/>
<button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward"/>
<group attrs="{'invisible':['|', ('state','=','posted'), ('paid','=',True)]}">
<group attrs="{'invisible':['|', ('state','!=','posted'), ('paid','=',True)]}">
<button icon="terp-dolar_ok!" name="%(act_pay_voucher)d" context="{'narration':narration, 'title':'Customer Payment', 'type':'receipt', 'partner_id':partner_id, 'reference':reference, 'amount':amount}" type="action" string="Pay" attrs="{'invisible':[('pay_now','=','pay_now')]}"/>
</group>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>