From 41ece280fb92c83acff63c65820ad15a82298412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 10 Sep 2012 15:28:28 +0200 Subject: [PATCH] Merge all kind of buttons review483002 --- purchase.py | 22 +++++++++++++++++++++- purchase.xml | 16 ++++++---------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/purchase.py b/purchase.py index 3cdb6f494c..5a78ea7169 100644 --- a/purchase.py +++ b/purchase.py @@ -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): diff --git a/purchase.xml b/purchase.xml index e32007a82e..692233d2b7 100644 --- a/purchase.xml +++ b/purchase.xml @@ -99,22 +99,18 @@ this repository contains the full copyright notices and license terms. -->