Taller/recepcion.py

48 lines
1.4 KiB
Python
Raw Normal View History

2023-07-25 14:17:46 -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-07-28 02:54:31 -05:00
from trytond.model import (ModelSQL, ModelView, fields, Workflow)
2023-07-25 14:17:46 -05:00
from datetime import datetime
class Recepcion(ModelView, ModelSQL, Workflow):
2023-07-25 14:17:46 -05:00
"Recepcion"
__name__= "taller.recepcion"
2023-07-25 19:57:47 -05:00
2023-07-25 14:17:46 -05:00
tercero = fields.Many2One("party.party", "Tercero")
metodo_contacto=fields.Many2One('party.contact_mechanism', "Contacto")
hora_entrada = fields.DateTime('Hora Entrada')
referencia = fields.Char("Referencia")
2023-07-26 02:14:44 -05:00
descripcion = fields.Text("Descripcion")
state = fields.Selection([("borrador","Borrador"),("registrado", "Registrado")],"Estado")
2023-07-25 14:17:46 -05:00
2023-07-28 02:54:31 -05:00
2023-07-25 14:17:46 -05:00
@classmethod
def default_hora_entrada(cls):
return datetime.now()
2023-07-26 02:14:44 -05:00
@classmethod
def default_state(cls):
2023-07-26 02:14:44 -05:00
return "borrador"
2023-07-28 02:54:31 -05:00
@classmethod #constructor clase
def __setup__(cls):
super(Recepcion, cls).__setup__()
cls._transitions=({("borrador","registrado"),("registrado","borrador") })
cls._buttons.update({"registrado":{}, "borrador":{}})
2023-07-28 02:54:31 -05:00
@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 14:17:46 -05:00