diff --git a/__pycache__/recepcion.cpython-39.opt-1.pyc b/__pycache__/recepcion.cpython-39.opt-1.pyc index 8d1f519..6d20a05 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 65cc963..6a5bd7e 100644 --- a/recepcion.py +++ b/recepcion.py @@ -1,6 +1,6 @@ # 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 (ModelSQL, ModelView, fields) +from trytond.model import (ModelSQL, ModelView, fields, Workflow) from datetime import datetime class Recepcion(ModelView, ModelSQL): @@ -14,6 +14,7 @@ class Recepcion(ModelView, ModelSQL): descripcion = fields.Text("Descripcion") estado = fields.Selection([("borrador","Borrador"),("registrado", "Registrado")],"Estado") + @classmethod def default_hora_entrada(cls): return datetime.now() @@ -22,6 +23,17 @@ class Recepcion(ModelView, ModelSQL): def default_estado(cls): return "borrador" + @classmethod #constructor clase + def __setup__(cls): + super(Recepcion, cls).__setup__() + cls._transitions=({("borrador","registrado"),("registrado","borrador") }) + cls._buttons.update({"registrado":{}}) + + @classmethod + @ModelView.button + @Workflow.transition("registrado") + def registrado(cls, records): + pass diff --git a/recepcion.xml b/recepcion.xml index 9cf5e95..8ab22ca 100644 --- a/recepcion.xml +++ b/recepcion.xml @@ -7,6 +7,11 @@ this repository contains the full copyright notices and license terms. --> taller.recepcion form recepcion_form + + + registrado + Registrado + diff --git a/view/recepcion_form.xml b/view/recepcion_form.xml index b2a6693..ea419f0 100644 --- a/view/recepcion_form.xml +++ b/view/recepcion_form.xml @@ -17,5 +17,7 @@ this repository contains the full copyright notices and license terms. -->