fix: Se hace visible button closed

This commit is contained in:
sinergia 2023-07-31 08:06:55 -05:00
parent d69283f90e
commit 6a8ebf7215
2 changed files with 5 additions and 4 deletions

View File

@ -111,7 +111,7 @@ class Contract(Workflow, ModelSQL, ModelView):
cls._buttons.update({ cls._buttons.update({
'draft': {'invisible': Eval('state').in_(['draft','closed'])}, 'draft': {'invisible': Eval('state').in_(['draft','closed'])},
'running': {'invisible': Eval('state').in_(['cancelled', 'running'])}, 'running': {'invisible': Eval('state').in_(['cancelled', 'running'])},
'closed': {'invisible': True}, 'closed': {'invisible': Eval('state').in_(['draft','cancelled'])},
'cancelled': {'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') @Workflow.transition('closed')
def closed(cls, contracts): def closed(cls, contracts):
contract = contracts[0] contract = contracts[0]
for equipment in contract.equipments: for equipment in contract.current_equipments:
equipment.state = "uncontrated" equipment.state = "uncontrated"
equipment.save() equipment.save()

View File

@ -42,9 +42,10 @@ this repository contains the full copyright notices and license terms. -->
<newline/> <newline/>
<label name="state"/> <label name="state"/>
<field name="state"/> <field name="state"/>
<group col="2" colspan="2" id="button"> <group col="6" id="button">
<button name="draft"/> <button name="draft"/>
<button name="cancelled"/> <button name="closed"/>
<button name="cancelled"/>
<button name="running"/> <button name="running"/>
</group> </group>
</form> </form>