diff --git a/pos_order_load/__openerp__.py b/pos_order_load/__openerp__.py index 87a0a749..4309e777 100644 --- a/pos_order_load/__openerp__.py +++ b/pos_order_load/__openerp__.py @@ -22,9 +22,10 @@ { 'name': 'POS Order Load and Save', - 'version': '0.2', + 'version': '8.0.1.0.0', 'author': 'Akretion,GRAP,Odoo Community Association (OCA)', 'category': 'Point Of Sale', + 'license': 'AGPL-3', 'depends': [ 'point_of_sale', ], diff --git a/pos_order_load/models/pos_order.py b/pos_order_load/models/pos_order.py index 6ae16184..25f66ffe 100644 --- a/pos_order_load/models/pos_order.py +++ b/pos_order_load/models/pos_order.py @@ -68,15 +68,16 @@ class PosOrder(models.Model): fields = ['name', 'partner_id', 'amount_total'] return self.search_read(condition, fields, limit=10) - @api.one - def load_order(self): - condition = [('order_id', '=', self.id)] + @api.model + def load_order(self, order_id): + order = self.browse(order_id) + condition = [('order_id', '=', order_id)] fields = ['product_id', 'price_unit', 'qty', 'discount'] orderlines = self.lines.search_read(condition, fields) return { - 'id': self.id, - 'name': self.pos_reference, - 'partner_id': self.partner_id and self.partner_id.id or False, + 'id': order.id, + 'name': order.pos_reference, + 'partner_id': self.partner_id.id, 'orderlines': orderlines } diff --git a/pos_order_load/static/src/js/pos_order_load.js b/pos_order_load/static/src/js/pos_order_load.js index 04d59f31..5cff51d9 100644 --- a/pos_order_load/static/src/js/pos_order_load.js +++ b/pos_order_load/static/src/js/pos_order_load.js @@ -95,8 +95,7 @@ openerp.pos_order_load = function(instance, local) { this.orderlist_screen.appendTo(this.$('.screens')); this.orderlist_screen.hide(); - this.screen_selector.screen_set['orderlist'] = - this.orderlist_screen; + this.screen_selector.screen_set.orderlist = this.orderlist_screen; // Add buttons this.load_button = new module.LoadButtonWidget(this,{}); @@ -232,10 +231,9 @@ openerp.pos_order_load = function(instance, local) { return orderModel.call('load_order', [order_id]) .then(function (result) { var order = self.pos.get('selectedOrder'); - var result = result[0]; order = self.load_order_fields(order, result); order.get('orderLines').reset(); - var orderlines = result.orderlines || []; + var orderlines = result.orderlines || []; var unknown_products = []; for (var i=0, len=orderlines.length; i