taller/recepcion.py

43 lines
1.3 KiB
Python
Raw Normal View History

2023-07-25 19:24:18 -05:00
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
2023-08-14 18:11:03 -05:00
from trytond.model import (ModelView, ModelSQL, fields,Workflow)
2023-07-25 19:24:18 -05:00
from datetime import datetime
2023-08-14 18:11:03 -05:00
class Recepcion(ModelView,ModelSQL,Workflow):
2023-07-25 19:24:18 -05:00
"recepcion"
__name__="taller.recepcion"
tercero =fields.Many2One("party.party","Tercero" )
contacto=fields.Many2One("party.contact_mechanism", "Contacto")
referencia=fields.Char("Referencia")
fecha_entrada=fields.DateTime("Fecha y hora de entrada")
2023-07-26 07:15:07 -05:00
descripcion=fields.Text("Descripcion")
2023-08-14 18:11:03 -05:00
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
2023-07-25 19:24:18 -05:00
@classmethod
def default_fecha_entrada(cls):
return datetime.now()
2023-07-26 07:15:07 -05:00
@classmethod
2023-08-14 18:11:03 -05:00
def default_state(cls):
2023-07-26 07:15:07 -05:00
return "borrador"