Merge all kind of buttons

review483002
This commit is contained in:
Cédric Krier committed 2012-09-10 15:27:42 +02:00
1 parent e070a8db26
commit e7a05236a7
2 files changed
+11 -7

No files matched your search

+10 -1
View File
@@ -8,7 +8,7 @@ from trytond.report import Report
from trytond.wizard import Wizard, StateView, StateTransition, StateAction, \
Button
from trytond.backend import TableHandler, FIELDS
from trytond.pyson import If, Eval, Bool
from trytond.pyson import If, Eval, Bool, Id
from trytond.tools import reduce_ids
from trytond.transaction import Transaction
from trytond.pool import Pool
@@ -204,6 +204,11 @@ class Invoice(Workflow, ModelSQL, ModelView):
'open': {
'invisible': ~Eval('state').in_(['draft', 'proforma']),
},
'pay': {
'invisible': Eval('state') != 'open',
'readonly': ~Eval('groups', []).contains(
Id('account', 'group_account')),
},
})
def init(self, module_name):
@@ -1285,6 +1290,10 @@ class Invoice(Workflow, ModelSQL, ModelView):
self.create_move(invoice)
self.print_invoice(invoice)
@ModelView.button_action('account_invoice.wizard_pay')
def pay(self, ids):
pass
def process(self, ids):
paid = []
open_ = []
+1 -6
View File
@@ -67,17 +67,12 @@ this repository contains the full copyright notices and license terms. -->
<button name="cancel" string="_Cancel"
icon="tryton-cancel"/>
<button name="draft" string="_Draft"
type="object"
icon="tryton-go-previous"/>
<button name="proforma" string="Pro For_ma"
type="object"
icon="tryton-go-next"/>
<button name="open" string="_Open"
type="object"
icon="tryton-ok"/>
<button name="%(wizard_pay)d" string="_Pay"
type="action"
states="{'invisible': Not(Equal(Eval('state'), 'open')), 'readonly': Not(In(%(account.group_account)d, Eval('groups', [])))}"
<button name="pay" string="_Pay"
icon="tryton-go-next"/>
</group>
</group>