diff --git a/locale/es.po b/locale/es.po
index 5217661..5503784 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -7,6 +7,18 @@ msgctxt "field:sale.printer,name:"
msgid "Name"
msgstr "Nombre"
+msgctxt "field:sale.printer,type_:"
+msgid "Type"
+msgstr "Tipo"
+
+msgctxt "selection:sale.printer,type_:"
+msgid "USB"
+msgstr "USB"
+
+msgctxt "selection:sale.printer,type_:"
+msgid "Network"
+msgstr "Red"
+
msgctxt "field:sale.printer,ip_address:"
msgid "IP Address or Network"
msgstr "Dirección IP"
diff --git a/printer.py b/printer.py
index 5f704f8..c670273 100644
--- a/printer.py
+++ b/printer.py
@@ -2,18 +2,20 @@ from trytond.model import Model, ModelSQL, ModelView, fields
from trytond.pyson import Eval
-
class Device(Model):
'Devices'
__name__ = 'sale_device'
name = fields.Char("Name")
- 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')
+ type_ = fields.Selection([
+ ('usb', "USB"),
+ ('network', "Network")], "Type")
+ ip_address = fields.Char(
+ 'IP Address or Network',
+ states={'required': Eval('type_') == 'network',
+ 'invisible': Eval('type_') == 'usb'},
+ 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',
@@ -24,9 +26,10 @@ class Device(Model):
})
@classmethod
- def default_type(cls):
+ def default_type_(cls):
return 'network'
-
+
+
class Printer(Device, ModelSQL, ModelView):
'Printer'
__name__ = 'sale.printer'
@@ -36,8 +39,8 @@ class Printer(Device, ModelSQL, ModelView):
('reception', "Reception")], "Zone")
shop = fields.Many2One('sale.shop', "Shop")
api = fields.Many2One('sale.printer_api', "API")
-
+
+
class Api(Device, ModelSQL, ModelView):
'Api printer'
__name__ = 'sale.printer_api'
-
diff --git a/shop.py b/shop.py
index a5574de..ed17848 100644
--- a/shop.py
+++ b/shop.py
@@ -1,8 +1,9 @@
-from trytond.model import Model, ModelSQL, ModelView, fields
-from trytond.pool import Pool, PoolMeta
+from trytond.model import fields
+from trytond.pool import PoolMeta
+
class Shop(metaclass=PoolMeta):
"Shop"
__name__ = 'sale.shop'
-
+
printers = fields.One2Many('sale.printer', 'shop', "Printers")
diff --git a/shop.xml b/shop.xml
index 7820e24..91ee1f2 100644
--- a/shop.xml
+++ b/shop.xml
@@ -8,10 +8,5 @@ this repository contains the full copyright notices and license terms. -->