Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] point_of_sale: IotBox instead of IP
Instead of typing the IP address of the box, the user will have to select an existing IoT box + dependency : when ticking "posbox" in pos setting, should install iot module (on the PoS settings)
- Loading branch information
Gert Pellin
committed
Sep 20, 2018
1 parent
3117afb
commit c0a6613
Showing
7 changed files
with
144 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
{ | ||
'name': "Point of Sale IoTBox integration", | ||
'summary': """Point of Sale IoTBox integration""", | ||
'description': """""", | ||
'category': 'Point of Sale', | ||
'version': '1.0.1', | ||
'depends': ['iot', 'point_of_sale'], | ||
'data': [ | ||
'views/pos_config_view.xml', | ||
], | ||
'installable': True, | ||
'application': False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import pos_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class PosConfig(models.Model): | ||
_inherit='pos.config' | ||
|
||
iface_cashdrawer = fields.Boolean(string='Cashdrawer', help="Automatically open the cashdrawer.", default=False) | ||
iface_electronic_scale = fields.Boolean(string='Electronic Scale', help="Enables Electronic Scale integration.", default=False) | ||
iface_customer_facing_display = fields.Boolean(string='Customer Facing Display', help="Show checkout to customers with a remotely-connected screen.", default=False) | ||
iface_print_via_proxy = fields.Boolean(string='Print via Proxy', help="Bypass browser printing and prints via the hardware proxy.", default=False) | ||
iface_scan_via_proxy = fields.Boolean(string='Scan via Proxy', help="Enable barcode scanning with a remotely connected barcode scanner.", default=False) | ||
|
||
iot_box_id = fields.Many2one('iot.box', string="IoTBox") | ||
proxy_ip = fields.Char(string='IP Address', related="iot_box_id.ip") | ||
|
||
@api.onchange('iface_print_via_proxy') | ||
def _onchange_iface_print_via_proxy(self): | ||
self.iface_print_auto = self.iface_print_via_proxy | ||
|
||
@api.onchange('iface_scan_via_proxy') | ||
def _onchange_iface_scan_via_proxy(self): | ||
if self.iface_scan_via_proxy: | ||
self.barcode_scanner = True | ||
else: | ||
self.barcode_scanner = False | ||
|
||
@api.onchange('module_pos_iot') | ||
def _onchange_module_pos_iot(self): | ||
if not self.module_pos_iot: | ||
self.iot_box_id = False | ||
self.proxy_ip='' | ||
self.iface_scan_via_proxy = False | ||
self.iface_electronic_scale = False | ||
self.iface_cashdrawer = False | ||
self.iface_print_via_proxy = False | ||
self.iface_customer_facing_display = False | ||
|
||
@api.multi | ||
def write(self, vals): | ||
config_display = self.filtered(lambda c: c.module_pos_iot and c.iface_customer_facing_display and not (c.customer_facing_display_html or '').strip()) | ||
if config_display: | ||
super(PosConfig, config_display).write({'customer_facing_display_html': self._compute_default_customer_html()}) | ||
|
||
return super(PosConfig, self).write(vals) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="pos_iot_config_view_form" model="ir.ui.view"> | ||
<field name="name">pos.iot.config.form.view</field> | ||
<field name="model">pos.config</field> | ||
<field name="inherit_id" ref="point_of_sale.pos_config_view_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//div[@name='session_iot']" position="replace"> | ||
<div class="o_setting_right_pane" name="session_iot"> | ||
<label for="module_pos_iot"/> | ||
<div class="text-muted"> | ||
Connect to an IoT Box to use hardware for the PoS | ||
</div> | ||
<div class="content-grou" attrs="{'invisible' : [('module_pos_iot', '=', False)]}"> | ||
<field name="iot_box_id"/> | ||
<div class="row"> | ||
<label string="Barcode Scanner" for="iface_scan_via_proxy" class="col-lg-3 o_light_label"/> | ||
<field name="iface_scan_via_proxy"/> | ||
</div> | ||
<div class="row"> | ||
<label string="Electronic Scale" for="iface_electronic_scale" class="col-lg-3 o_light_label"/> | ||
<field name="iface_electronic_scale"/> | ||
</div> | ||
<div class="row"> | ||
<label string="Cashdrawer" for="iface_cashdrawer" class="col-lg-3 o_light_label"/> | ||
<field name="iface_cashdrawer"/> | ||
</div> | ||
<div class="row"> | ||
<label string="Receipt Printer" for="iface_print_via_proxy" class="col-lg-3 o_light_label"/> | ||
<field name="iface_print_via_proxy"/> | ||
</div> | ||
<div class="row"> | ||
<label string="Customer Display" for="iface_customer_facing_display" class="col-lg-3 o_light_label"/> | ||
<field name="iface_customer_facing_display"/> | ||
</div> | ||
<field name="customer_facing_display_html" invisible="1"/> | ||
<div class="text-muted" attrs="{'invisible' : ['|', ('iface_customer_facing_display', '=', False), '&', ('id', '!=', False), ('customer_facing_display_html', '!=', '')]}">Save this configuration to see and edit the customer display</div> | ||
<div class="row mt16 o_settings_container" attrs="{'invisible' : ['|', '|',('iface_customer_facing_display', '=', False), ('id', '=', False), ('customer_facing_display_html', '=', '')]}"> | ||
<div class="col-12 col-lg-6 o_setting_box"> | ||
<field name="customer_facing_display_html" widget="html_frame" nolabel="1" options="{'editor_url': '/point_of_sale/field/customer_facing_display_template'}"/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</xpath> | ||
<xpath expr="//div[@name='session_reprint']" position="replace"> | ||
<div name="session_reprint" class="col-12 col-lg-6 o_setting_box" attrs="{'invisible': [('iface_print_via_proxy','=',False)]}"> | ||
<div class="o_setting_left_pane"> | ||
<field name='module_pos_reprint'/> | ||
</div> | ||
<div class="o_setting_right_pane"> | ||
<label for="module_pos_reprint"/> | ||
<div class="text-muted"> | ||
Allow cashier to reprint receipts | ||
</div> | ||
<div class="content-group" attrs="{'invisible': [('module_pos_reprint', '=', False)]}"> | ||
<div class="mt16" id="btn_use_pos_reprint"> | ||
<button string="Save" type="object" name="execute" class="oe_highlight"/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |