diff --git a/pos_order_mgmt/__init__.py b/pos_order_mgmt/__init__.py index 0650744f..23ac4f95 100644 --- a/pos_order_mgmt/__init__.py +++ b/pos_order_mgmt/__init__.py @@ -1 +1,3 @@ +# coding=utf-8 + from . import models diff --git a/pos_order_mgmt/__manifest__.py b/pos_order_mgmt/__manifest__.py index 8bc6bede..ed744a84 100644 --- a/pos_order_mgmt/__manifest__.py +++ b/pos_order_mgmt/__manifest__.py @@ -1,3 +1,5 @@ +# coding=utf-8 + # Copyright 2018 GRAP - Sylvain LE GAL # Copyright 2018 Tecnativa S.L. - David Vidal # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -5,7 +7,7 @@ { 'name': 'POS Frontend Orders Management', 'summary': 'Manage old POS Orders from the frontend', - 'version': '12.0.1.0.3', + 'version': '10.0.1.0.3', 'category': 'Point of Sale', 'author': 'GRAP, ' 'Tecnativa, ' diff --git a/pos_order_mgmt/models/__init__.py b/pos_order_mgmt/models/__init__.py index 234b311e..8207c942 100644 --- a/pos_order_mgmt/models/__init__.py +++ b/pos_order_mgmt/models/__init__.py @@ -1,2 +1,4 @@ +# coding=utf-8 + from . import pos_config from . import pos_order diff --git a/pos_order_mgmt/models/pos_config.py b/pos_order_mgmt/models/pos_config.py index 8f53d4be..6b21eff2 100644 --- a/pos_order_mgmt/models/pos_config.py +++ b/pos_order_mgmt/models/pos_config.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright 2018 GRAP - Sylvain LE GAL # Copyright 2018 Tecnativa S.L. - David Vidal # Copyright 2019 Coop IT Easy SCRLfs diff --git a/pos_order_mgmt/models/pos_order.py b/pos_order_mgmt/models/pos_order.py index 85cac5e3..d2facfc7 100644 --- a/pos_order_mgmt/models/pos_order.py +++ b/pos_order_mgmt/models/pos_order.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright 2018 GRAP - Sylvain LE GAL # Copyright 2018 Tecnativa S.L. - David Vidal # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -58,7 +59,7 @@ class PosOrder(models.Model): @api.returns('self', lambda value: value.id) def copy(self, default=None): self.ensure_one() - order = super().copy(default=default) + order = super(PosOrder, self).copy(default=default) if self.env.context.get('refund', False): order.returned_order_id = self.id return order @@ -153,7 +154,7 @@ class PosOrder(models.Model): @api.model def _order_fields(self, ui_order): - res = super()._order_fields(ui_order) + res = super(PosOrder, self)._order_fields(ui_order) res.update({ 'returned_order_id': ui_order.get('returned_order_id', False), }) diff --git a/pos_order_mgmt/readme/CONTRIBUTORS.rst b/pos_order_mgmt/readme/CONTRIBUTORS.rst index e49bf7b1..71f83945 100644 --- a/pos_order_mgmt/readme/CONTRIBUTORS.rst +++ b/pos_order_mgmt/readme/CONTRIBUTORS.rst @@ -3,3 +3,4 @@ * Carlos Martínez * Pierrick Brun * Iván Todorovich +* Roberto Fichera diff --git a/pos_order_mgmt/static/src/js/widgets.js b/pos_order_mgmt/static/src/js/widgets.js index 2d6c7660..a63b1420 100644 --- a/pos_order_mgmt/static/src/js/widgets.js +++ b/pos_order_mgmt/static/src/js/widgets.js @@ -13,6 +13,7 @@ odoo.define('pos_order_mgmt.widgets', function (require) { var gui = require('point_of_sale.gui'); var chrome = require('point_of_sale.chrome'); var pos = require('point_of_sale.models'); + var Model = require('web.Model'); var QWeb = core.qweb; var ScreenWidget = screens.ScreenWidget; @@ -21,7 +22,7 @@ odoo.define('pos_order_mgmt.widgets', function (require) { screens.ReceiptScreenWidget.include({ render_receipt: function () { if (!this.pos.reloaded_order) { - return this._super(); + return this._super.apply(this, arguments); } var order = this.pos.reloaded_order; this.$('.pos-receipt-container').html(QWeb.render('PosTicket', { @@ -36,7 +37,7 @@ odoo.define('pos_order_mgmt.widgets', function (require) { }, click_next: function () { if (!this.pos.from_loaded_order) { - return this._super(); + return this._super.apply(this, arguments); } this.pos.from_loaded_order = false; // When reprinting a loaded order we temporarily set it as the @@ -75,7 +76,7 @@ odoo.define('pos_order_mgmt.widgets', function (require) { this.gui.screen_instances.receipt.click_next(); this.gui.show_screen('orderlist'); } - this._super(); + this._super.apply(this, arguments); this.renderElement(); this.old_order = this.pos.get_order(); this.$('.back').click(function () { @@ -178,23 +179,14 @@ odoo.define('pos_order_mgmt.widgets', function (require) { this.pos.set_order(order); - if (this.pos.config.iface_print_via_proxy) { - this.pos.proxy.print_receipt(QWeb.render( - 'XmlReceipt', { - receipt: order.export_for_printing(), - widget: this, - pos: this.pos, - order: order, - orderlines: order.get_orderlines(), - paymentlines: order.get_paymentlines(), - })); - this.pos.set_order(this.pos.current_order); - this.pos.current_order = false; - } else { - this.pos.reloaded_order = order; - this.gui.show_screen('receipt'); - this.pos.reloaded_order = false; - } + this.pos.reloaded_order = order; + var skip_screen_state = this.pos.config.iface_print_skip_screen; + // Disable temporarily skip screen if set + this.pos.config.iface_print_skip_screen = false; + this.gui.show_screen('receipt'); + this.pos.reloaded_order = false; + // Set skip screen to whatever previous state + this.pos.config.iface_print_skip_screen = skip_screen_state; // If it's invoiced, we also print the invoice if (order_data.to_invoice) { @@ -335,27 +327,25 @@ odoo.define('pos_order_mgmt.widgets', function (require) { load_order_data: function (order_id) { var self = this; - return this._rpc({ - model: 'pos.order', - method: 'load_done_order_for_pos', - args: [order_id], - }).fail(function (error) { - if (parseInt(error.code, 10) === 200) { - // Business Logic Error, not a connection problem - self.gui.show_popup( - 'error-traceback', { - 'title': error.data.message, - 'body': error.data.debug, + return new Model('pos.order') + .call('load_done_order_for_pos', [order_id]) + .fail(function (error) { + if (parseInt(error.code, 10) === 200) { + // Business Logic Error, not a connection problem + self.gui.show_popup( + 'error-traceback', { + 'title': error.data.message, + 'body': error.data.debug, + }); + } else { + self.gui.show_popup('error', { + 'title': _t('Connection error'), + 'body': _t( + 'Can not execute this action because the POS' + + ' is currently offline'), }); - } else { - self.gui.show_popup('error', { - 'title': _t('Connection error'), - 'body': _t( - 'Can not execute this action because the POS' + - ' is currently offline'), - }); - } - }); + } + }); }, load_order_from_data: function (order_data, action) { @@ -380,38 +370,36 @@ odoo.define('pos_order_mgmt.widgets', function (require) { // Search Part search_done_orders: function (query) { var self = this; - return this._rpc({ - model: 'pos.order', - method: 'search_done_orders_for_pos', - args: [query || '', this.pos.pos_session.id], - }).then(function (result) { - self.orders = result; - // Get the date in local time - _.each(self.orders, function (order) { - if (order.date_order) { - order.date_order = moment.utc(order.date_order) - .local().format('YYYY-MM-DD HH:mm:ss'); - } - }); - }).fail(function (error, event) { - if (parseInt(error.code, 10) === 200) { - // Business Logic Error, not a connection problem - self.gui.show_popup( - 'error-traceback', { - 'title': error.data.message, - 'body': error.data.debug, + return new Model('pos.order') + .call('search_done_orders_for_pos', [query || '', this.pos.pos_session.id]) + .then(function (result) { + self.orders = result; + // Get the date in local time + _.each(self.orders, function (order) { + if (order.date_order) { + order.date_order = moment.utc(order.date_order) + .local().format('YYYY-MM-DD HH:mm:ss'); } - ); - } else { - self.gui.show_popup('error', { - 'title': _t('Connection error'), - 'body': _t( - 'Can not execute this action because the POS' + - ' is currently offline'), }); - } - event.preventDefault(); - }); + }).fail(function (error, event) { + if (parseInt(error.code, 10) === 200) { + // Business Logic Error, not a connection problem + self.gui.show_popup( + 'error-traceback', { + 'title': error.data.message, + 'body': error.data.debug, + } + ); + } else { + self.gui.show_popup('error', { + 'title': _t('Connection error'), + 'body': _t( + 'Can not execute this action because the POS' + + ' is currently offline'), + }); + } + event.preventDefault(); + }); }, perform_search: function () { @@ -451,7 +439,7 @@ odoo.define('pos_order_mgmt.widgets', function (require) { renderElement: function () { var self = this; - this._super(); + this._super.apply(this, arguments); this.$el.click(function () { self.button_click(); }); diff --git a/pos_order_mgmt/static/src/xml/pos.xml b/pos_order_mgmt/static/src/xml/pos.xml index 769ae352..b2cc9209 100644 --- a/pos_order_mgmt/static/src/xml/pos.xml +++ b/pos_order_mgmt/static/src/xml/pos.xml @@ -84,7 +84,7 @@ - +
DUPLICATE

diff --git a/pos_order_mgmt/tests/test_module.py b/pos_order_mgmt/tests/test_module.py index 1478a90a..ef7206a0 100644 --- a/pos_order_mgmt/tests/test_module.py +++ b/pos_order_mgmt/tests/test_module.py @@ -16,7 +16,7 @@ class TestModule(TransactionCase): self.AccountPayment = self.env['account.payment'] # Get Object - self.pos_product = self.env.ref('point_of_sale.whiteboard_pen') + self.pos_product = self.env.ref('point_of_sale.limon') self.pricelist = self.env.ref('product.list0') self.partner = self.env.ref('base.res_partner_12') diff --git a/pos_order_mgmt/views/view_pos_config.xml b/pos_order_mgmt/views/view_pos_config.xml index c2221379..5cca7da8 100644 --- a/pos_order_mgmt/views/view_pos_config.xml +++ b/pos_order_mgmt/views/view_pos_config.xml @@ -2,45 +2,29 @@ pos.config - + -
-
-
- -
-
-
-
-
+ + + + + + + + + + + + +