From fe4d332806168edd2b0e57cca2ca0e2cab42154e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 10 Sep 2012 15:28:33 +0200 Subject: [PATCH] Merge all kind of buttons review483002 --- sale.py | 22 +++++++++++++++++++++- sale.xml | 26 +++++++++++--------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/sale.py b/sale.py index 1f0480d2b1..e6b7ab28cf 100644 --- a/sale.py +++ b/sale.py @@ -10,7 +10,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 If, Eval, Bool, PYSONEncoder +from trytond.pyson import If, Eval, Bool, PYSONEncoder, Id from trytond.transaction import Transaction from trytond.pool import Pool from trytond.config import CONFIG @@ -202,6 +202,18 @@ class Sale(Workflow, ModelSQL, ModelView): 'process': { 'invisible': Eval('state') != 'confirmed', }, + 'handle_invoice_exception': { + 'invisible': ((Eval('invoice_state') != 'exception') + | (Eval('state') == 'cancel')), + 'readonly': ~Eval('groups', []).contains( + Id('sale', 'group_sale')), + }, + 'handle_shipment_exception': { + 'invisible': ((Eval('shipment_state') != 'exception') + | (Eval('state') == 'cancel')), + 'readonly': ~Eval('groups', []).contains( + Id('sale', 'group_sale')), + }, }) # The states where amounts are cached self._states_cached = ['confirmed', 'processing', 'done', 'cancel'] @@ -910,6 +922,14 @@ class Sale(Workflow, ModelSQL, ModelView): self.set_sale_date(ids) self.store_cache(ids) + @ModelView.button_action('sale.wizard_invoice_handle_exception') + def handle_invoice_exception(self, ids): + pass + + @ModelView.button_action('sale.wizard_shipment_handle_exception') + def handle_shipment_exception(self, ids): + pass + @ModelView.button @Workflow.transition('processing') def process(self, ids): diff --git a/sale.xml b/sale.xml index 6c9cdbbe12..3aec2783fb 100644 --- a/sale.xml +++ b/sale.xml @@ -89,24 +89,20 @@ this repository contains the full copyright notices and license terms. -->