diff --git a/__pycache__/recepcion.cpython-39.opt-1.pyc b/__pycache__/recepcion.cpython-39.opt-1.pyc index 6351248..f1192a0 100644 Binary files a/__pycache__/recepcion.cpython-39.opt-1.pyc and b/__pycache__/recepcion.cpython-39.opt-1.pyc differ diff --git a/recepcion.py b/recepcion.py index 32edcf4..639a242 100644 --- a/recepcion.py +++ b/recepcion.py @@ -1,9 +1,9 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -from trytond.model import (ModelView, ModelSQL, fields) +from trytond.model import (ModelView, ModelSQL, fields,Workflow) from datetime import datetime -class Recepcion(ModelView,ModelSQL): +class Recepcion(ModelView,ModelSQL,Workflow): "recepcion" __name__="taller.recepcion" tercero =fields.Many2One("party.party","Tercero" ) @@ -11,11 +11,32 @@ class Recepcion(ModelView,ModelSQL): referencia=fields.Char("Referencia") fecha_entrada=fields.DateTime("Fecha y hora de entrada") descripcion=fields.Text("Descripcion") - estado= fields.Selection([("borrador","Borrador"),("registrado","Registrado")],"Estado") + state= fields.Selection([("borrador","Borrador"),("registrado","Registrado")],"Estado") + + + @classmethod + def __setup__(cls): + super(Recepcion,cls).__setup__() + cls._transitions=({("borrador","registrado"),("registrado","borrador")}) + cls._buttons.update({"registrado":{},"borrador":{} }) + + @classmethod + @ModelView.button + @Workflow.transition("registrado") + def registrado(cls, records): + pass + + @classmethod + @ModelView.button + @Workflow.transition("borrador") + def borrador(cls, records): + pass + + @classmethod def default_fecha_entrada(cls): return datetime.now() @classmethod - def default_estado(cls): + def default_state(cls): return "borrador" diff --git a/recepcion.xml b/recepcion.xml index 5fd43aa..e93d328 100644 --- a/recepcion.xml +++ b/recepcion.xml @@ -8,5 +8,15 @@ this repository contains the full copyright notices and license terms. --> form recepcion_form - + + registrado + Registrado + + + + borrador + Borrador + + + diff --git a/view/recepcion_form.xml b/view/recepcion_form.xml index bef5bf0..cb4ae32 100644 --- a/view/recepcion_form.xml +++ b/view/recepcion_form.xml @@ -15,8 +15,9 @@ this repository contains the full copyright notices and license terms. -->