ACCOUNT: pay only invoice if not in state draft
authorced <>
Mon, 19 Feb 2007 09:53:11 +0000 (09:53 +0000)
committerced <>
Mon, 19 Feb 2007 09:53:11 +0000 (09:53 +0000)
bzr revid: ced-83cb9e7954faa424d5b5d48669159c7a1b6da20d

addons/account/wizard/wizard_pay_invoice.py

index 807a6eb..da578d2 100644 (file)
@@ -86,6 +86,8 @@ def _get_period(self, cr, uid, data, context={}):
        if len(ids):
                period_id = ids[0]
        invoice = pool.get('account.invoice').browse(cr, uid, data['id'], context)
+       if invoice.state == 'draft':
+               raise wizard.except_wizard('Error !', 'Can not pay draft invoice.')
        return {'period_id': period_id, 'amount': invoice.amount_total}
 
 class wizard_pay_invoice(wizard.interface):