feat: Se añade Tipo Usb
This commit is contained in:
23
printer.py
23
printer.py
@@ -1,13 +1,32 @@
|
||||
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'
|
||||
__name__ = 'sale.printer'
|
||||
|
||||
Reference in New Issue
Block a user