add button registrado
This commit is contained in:
parent
ca137b324f
commit
92147163ad
Binary file not shown.
14
recepcion.py
14
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
|
||||
|
||||
|
||||
|
||||
|
@ -7,6 +7,11 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="model">taller.recepcion</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">recepcion_form</field>
|
||||
</record>
|
||||
<record model="ir.model.button" id="registrado_recepcion_button">
|
||||
<field name="name">registrado</field>
|
||||
<field name="string">Registrado</field>
|
||||
<field name="model" search="[('model', '=', 'taller.recepcion')]"/>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
@ -17,5 +17,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="descripcion"/>
|
||||
<label name="estado"/>
|
||||
<field name="estado"/>
|
||||
<button name="registrado"/>
|
||||
|
||||
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user