feat: Se añade Tipo Usb
This commit is contained in:
parent
548b38e2a4
commit
69e81993d4
21
printer.py
21
printer.py
@ -1,12 +1,31 @@
|
||||
from trytond.model import Model, ModelSQL, ModelView, fields
|
||||
from trytond.pyson import Eval
|
||||
|
||||
|
||||
|
||||
class Device(Model):
|
||||
'Devices'
|
||||
__name__ = 'sale_device'
|
||||
|
||||
name = fields.Char("Name")
|
||||
ip_address = fields.Char('IP Address or Network', help='IPv4 or IPv6 IP address or network. Valid values include: 192.168.0.26 or 192.168.0.0/24')
|
||||
type_ = fields.Selection([('usb', "Usb"),
|
||||
('network', "Network")], "Type")
|
||||
ip_address = fields.Char('IP Address or Network',
|
||||
states={'required': Eval('type_') == 'network',
|
||||
'invisible': Eval('type_') != 'network'},
|
||||
help='IPv4 or IPv6 IP address or network. Valid values include: 192.168.0.26 or 192.168.0.0/24')
|
||||
idVendor = fields.Char('idVendor', states={
|
||||
'required': Eval('type_') == 'usb',
|
||||
'invisible': Eval('type_') != 'usb',
|
||||
})
|
||||
idProduct = fields.Char('idProduct', states={
|
||||
'required': Eval('type_') == 'usb',
|
||||
'invisible': Eval('type_') != 'usb',
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def default_type(cls):
|
||||
return 'network'
|
||||
|
||||
class Printer(Device, ModelSQL, ModelView):
|
||||
'Printer'
|
||||
|
@ -4,12 +4,18 @@
|
||||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="ip_address"/>
|
||||
<field name="ip_address"/>
|
||||
<label name="api"/>
|
||||
<field name="api"/>
|
||||
<label name="zone"/>
|
||||
<field name="zone"/>
|
||||
<label name="shop"/>
|
||||
<field name="shop"/>
|
||||
<label name="zone"/>
|
||||
<field name="zone"/>
|
||||
<label name="type_"/>
|
||||
<field name="type_"/>
|
||||
<label name="ip_address"/>
|
||||
<field name="ip_address"/>
|
||||
<label name="idVendor"/>
|
||||
<field name="idVendor"/>
|
||||
<label name="idProduct"/>
|
||||
<field name="idProduct"/>
|
||||
</form>
|
||||
|
@ -3,5 +3,6 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="type_"/>
|
||||
<field name="ip_address"/>
|
||||
</tree>
|
||||
|
Loading…
Reference in New Issue
Block a user