From 6a8ebf7215b961f1691907027208ff715cf506a8 Mon Sep 17 00:00:00 2001 From: sinergia Date: Mon, 31 Jul 2023 08:06:55 -0500 Subject: [PATCH] fix: Se hace visible button closed --- contract.py | 4 ++-- view/contract_form.xml | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/contract.py b/contract.py index d5e6f91..de7acae 100644 --- a/contract.py +++ b/contract.py @@ -111,7 +111,7 @@ class Contract(Workflow, ModelSQL, ModelView): cls._buttons.update({ 'draft': {'invisible': Eval('state').in_(['draft','closed'])}, 'running': {'invisible': Eval('state').in_(['cancelled', 'running'])}, - 'closed': {'invisible': True}, + 'closed': {'invisible': Eval('state').in_(['draft','cancelled'])}, 'cancelled': {'invisible': Eval('state').in_(['draft', 'cancelled'])} }) @@ -168,7 +168,7 @@ class Contract(Workflow, ModelSQL, ModelView): @Workflow.transition('closed') def closed(cls, contracts): contract = contracts[0] - for equipment in contract.equipments: + for equipment in contract.current_equipments: equipment.state = "uncontrated" equipment.save() diff --git a/view/contract_form.xml b/view/contract_form.xml index ed4a065..c3631a0 100644 --- a/view/contract_form.xml +++ b/view/contract_form.xml @@ -42,9 +42,10 @@ this repository contains the full copyright notices and license terms. -->