Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bcd3211caa | |||
| e274297c77 | |||
| f3367ebbe5 | |||
|
|
69e81993d4 |
12
locale/es.po
12
locale/es.po
@@ -7,6 +7,18 @@ msgctxt "field:sale.printer,name:"
|
|||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Nombre"
|
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:"
|
msgctxt "field:sale.printer,ip_address:"
|
||||||
msgid "IP Address or Network"
|
msgid "IP Address or Network"
|
||||||
msgstr "Dirección IP"
|
msgstr "Dirección IP"
|
||||||
|
|||||||
32
printer.py
32
printer.py
@@ -1,13 +1,35 @@
|
|||||||
from trytond.model import Model, ModelSQL, ModelView, fields
|
from trytond.model import Model, ModelSQL, ModelView, fields
|
||||||
|
from trytond.pyson import Eval
|
||||||
|
|
||||||
|
|
||||||
class Device(Model):
|
class Device(Model):
|
||||||
'Devices'
|
'Devices'
|
||||||
__name__ = 'sale_device'
|
__name__ = 'sale_device'
|
||||||
|
|
||||||
name = fields.Char("Name")
|
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_') == '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',
|
||||||
|
})
|
||||||
|
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):
|
class Printer(Device, ModelSQL, ModelView):
|
||||||
'Printer'
|
'Printer'
|
||||||
__name__ = 'sale.printer'
|
__name__ = 'sale.printer'
|
||||||
@@ -17,8 +39,8 @@ class Printer(Device, ModelSQL, ModelView):
|
|||||||
('reception', "Reception")], "Zone")
|
('reception', "Reception")], "Zone")
|
||||||
shop = fields.Many2One('sale.shop', "Shop")
|
shop = fields.Many2One('sale.shop', "Shop")
|
||||||
api = fields.Many2One('sale.printer_api', "API")
|
api = fields.Many2One('sale.printer_api', "API")
|
||||||
|
|
||||||
|
|
||||||
class Api(Device, ModelSQL, ModelView):
|
class Api(Device, ModelSQL, ModelView):
|
||||||
'Api printer'
|
'Api printer'
|
||||||
__name__ = 'sale.printer_api'
|
__name__ = 'sale.printer_api'
|
||||||
|
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -127,7 +127,7 @@ setup(name=name,
|
|||||||
],
|
],
|
||||||
license='GPL-3',
|
license='GPL-3',
|
||||||
python_requires='>=3.7',
|
python_requires='>=3.7',
|
||||||
install_requires=requires,
|
# install_requires=requires,
|
||||||
extras_require={
|
extras_require={
|
||||||
'test': tests_require,
|
'test': tests_require,
|
||||||
},
|
},
|
||||||
|
|||||||
7
shop.py
7
shop.py
@@ -1,8 +1,9 @@
|
|||||||
from trytond.model import Model, ModelSQL, ModelView, fields
|
from trytond.model import fields
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import PoolMeta
|
||||||
|
|
||||||
|
|
||||||
class Shop(metaclass=PoolMeta):
|
class Shop(metaclass=PoolMeta):
|
||||||
"Shop"
|
"Shop"
|
||||||
__name__ = 'sale.shop'
|
__name__ = 'sale.shop'
|
||||||
|
|
||||||
printers = fields.One2Many('sale.printer', 'shop', "Printers")
|
printers = fields.One2Many('sale.printer', 'shop', "Printers")
|
||||||
|
|||||||
5
shop.xml
5
shop.xml
@@ -8,10 +8,5 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<field name="inherit" ref="sale_shop.sale_shop_view_form"/>
|
<field name="inherit" ref="sale_shop.sale_shop_view_form"/>
|
||||||
<field name="name">shop_form</field>
|
<field name="name">shop_form</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.ui.view" id="sale_shop_view_tree">
|
|
||||||
<field name="model">sale.device</field>
|
|
||||||
<field name="inherit" ref="sale_shop.sale_shop_view_tree"/>
|
|
||||||
<field name="name">shop_tree</field>
|
|
||||||
</record>
|
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</tryton>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[tryton]
|
[tryton]
|
||||||
version=6.8.0
|
version=7.6.0
|
||||||
depends:
|
depends:
|
||||||
ir
|
ir
|
||||||
sale
|
sale
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
<form>
|
<form>
|
||||||
<label name="name"/>
|
<label name="name"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<label name="type_"/>
|
||||||
|
<field name="type_"/>
|
||||||
<label name="ip_address"/>
|
<label name="ip_address"/>
|
||||||
<field name="ip_address"/>
|
<field name="ip_address"/>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
this repository contains the full copyright notices and license terms. -->
|
this repository contains the full copyright notices and license terms. -->
|
||||||
<tree>
|
<tree>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="ip_address"/>
|
<field name="type_"/>
|
||||||
|
<field name="ip_address"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|||||||
@@ -4,12 +4,18 @@
|
|||||||
<form>
|
<form>
|
||||||
<label name="name"/>
|
<label name="name"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<label name="ip_address"/>
|
|
||||||
<field name="ip_address"/>
|
|
||||||
<label name="api"/>
|
<label name="api"/>
|
||||||
<field name="api"/>
|
<field name="api"/>
|
||||||
<label name="zone"/>
|
|
||||||
<field name="zone"/>
|
|
||||||
<label name="shop"/>
|
<label name="shop"/>
|
||||||
<field 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>
|
</form>
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
this repository contains the full copyright notices and license terms. -->
|
this repository contains the full copyright notices and license terms. -->
|
||||||
<tree>
|
<tree>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="ip_address"/>
|
<field name="shop"/>
|
||||||
|
<field name="type_"/>
|
||||||
|
<field name="ip_address"/>
|
||||||
|
<field name="idVendor"/>
|
||||||
|
<field name="idProduct"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|||||||
Reference in New Issue
Block a user