Merge all kind of buttons
review483002
This commit is contained in:
1 parent
6eac20694a
commit
41ece280fb
2 files changed
+27
-11
No files matched your search
+21
-1
@@ -8,7 +8,7 @@ from trytond.modules.company import CompanyReport
|
||||
from trytond.wizard import Wizard, StateAction, StateView, StateTransition, \
|
||||
Button
|
||||
from trytond.backend import TableHandler
|
||||
from trytond.pyson import Eval, Bool, If, PYSONEncoder
|
||||
from trytond.pyson import Eval, Bool, If, PYSONEncoder, Id
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.config import CONFIG
|
||||
@@ -164,6 +164,18 @@ class Purchase(Workflow, ModelSQL, ModelView):
|
||||
'confirm': {
|
||||
'invisible': Eval('state') != 'quotation',
|
||||
},
|
||||
'handle_invoice_exception': {
|
||||
'invisible': ((Eval('invoice_state') != 'exception')
|
||||
| (Eval('state') == 'cancel')),
|
||||
'readonly': ~Eval('groups', []).contains(
|
||||
Id('purchase', 'group_purchase')),
|
||||
},
|
||||
'handle_shipment_exception': {
|
||||
'invisible': ((Eval('shipment_state') != 'exception')
|
||||
| (Eval('state') == 'cancel')),
|
||||
'readonly': ~Eval('groups', []).contains(
|
||||
Id('purchase', 'group_purchase')),
|
||||
},
|
||||
})
|
||||
# The states where amounts are cached
|
||||
self._states_cached = ['confirmed', 'done', 'cancel']
|
||||
@@ -778,6 +790,14 @@ class Purchase(Workflow, ModelSQL, ModelView):
|
||||
self.store_cache(ids)
|
||||
self.process(ids)
|
||||
|
||||
@ModelView.button_action('purchase.wizard_invoice_handle_exception')
|
||||
def handle_invoice_exception(self, ids):
|
||||
pass
|
||||
|
||||
@ModelView.button_action('purchase.wizard_shipment_handle_exception')
|
||||
def handle_shipment_exception(self, ids):
|
||||
pass
|
||||
|
||||
def process(self, ids):
|
||||
done = []
|
||||
for purchase in self.browse(ids):
|
||||
|
||||
+6
-10
@@ -99,22 +99,18 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="total_amount" xalign="1.0" xexpand="1"/>
|
||||
<field name="total_amount" xalign="1.0" xexpand="0"/>
|
||||
<group col="6" colspan="2" id="buttons">
|
||||
<button name="cancel" type="object" string="Cancel"
|
||||
<button name="cancel" string="Cancel"
|
||||
icon="tryton-cancel"/>
|
||||
<button name="draft" type="object" string="Draft"/>
|
||||
<button name="quote" type="object" string="Quote"
|
||||
<button name="draft" string="Draft"/>
|
||||
<button name="quote" string="Quote"
|
||||
icon="tryton-go-next"/>
|
||||
<button name="%(wizard_invoice_handle_exception)d"
|
||||
<button name="handle_invoice_exception"
|
||||
string="Handle Invoice Exception"
|
||||
type="action"
|
||||
states="{'invisible': Or(Not(Equal(Eval('invoice_state'), 'exception')), Equal(Eval('state'), 'cancel')), 'readonly': Not(In(%(group_purchase)d, Eval('groups', [])))}"
|
||||
icon="tryton-go-next"/>
|
||||
<button name="%(wizard_shipment_handle_exception)d"
|
||||
<button name="handle_shipment_exception"
|
||||
string="Handle Shipment Exception"
|
||||
type="action"
|
||||
states="{'invisible': Or(Not(Equal(Eval('shipment_state'), 'exception')), Equal(Eval('state'), 'cancel')), 'readonly': Not(In(%(group_purchase)d, Eval('groups', [])))}"
|
||||
icon="tryton-go-next"/>
|
||||
<button name="confirm" type="object" string="Confirm"
|
||||
<button name="confirm" string="Confirm"
|
||||
icon="tryton-ok"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
Reference in new issue
Block a user