From 64ff58f90793535da8b682956c3344ee95d17dab Mon Sep 17 00:00:00 2001 From: Sreejith P Date: Tue, 29 May 2018 15:09:44 +0530 Subject: [PATCH] [FIX]Type Error fixed --- product_return_pos/__manifest__.py | 5 ++--- product_return_pos/models/pos_return.py | 9 +++++---- product_return_pos/static/src/js/pos_return.js | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/product_return_pos/__manifest__.py b/product_return_pos/__manifest__.py index de73aab54..deb4de89b 100644 --- a/product_return_pos/__manifest__.py +++ b/product_return_pos/__manifest__.py @@ -3,8 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # Copyright (C) 2017-TODAY Cybrosys Technologies(). -# Author: Anusha () -# +# Author: Anusha P P() # This program is free software: you can modify # it under the terms of the GNU Affero General Public License (AGPL) as # published by the Free Software Foundation, either version 3 of the @@ -21,7 +20,7 @@ ################################################################################### { 'name': 'Product Return In POS', - 'version': '10.0.1.0.0', + 'version': '10.0.1.1.0', 'category': 'Point of Sale', 'summary': 'POS Order Return', 'author': 'Cybrosys Techno Solutions', diff --git a/product_return_pos/models/pos_return.py b/product_return_pos/models/pos_return.py index c96f284f0..4f507ed41 100644 --- a/product_return_pos/models/pos_return.py +++ b/product_return_pos/models/pos_return.py @@ -50,7 +50,7 @@ class PosReturn(models.Model): if line: qty = -(data[2]['qty']) line.returned_qty += qty - if ui_order['return_ref']: + if 'return_ref' in ui_order.keys() and ui_order['return_ref']: order['return_ref'] = ui_order['return_ref'] parent_order = self.search([('pos_reference', '=', ui_order['return_ref'])], limit=1) lines = self.env['pos.order.line'].search([('order_id', '=', parent_order.id)]) @@ -61,11 +61,12 @@ class PosReturn(models.Model): if line.returned_qty: ret += 1 if qty-ret == 0: - parent_order.return_status = 'fully_return' + if parent_order: + parent_order.return_status = 'fully_return' elif ret: if qty > ret: - parent_order.return_status = 'partialy_return' - + if parent_order: + parent_order.return_status = 'partialy_return' return order @api.model diff --git a/product_return_pos/static/src/js/pos_return.js b/product_return_pos/static/src/js/pos_return.js index a69e05e12..9c10e76a3 100644 --- a/product_return_pos/static/src/js/pos_return.js +++ b/product_return_pos/static/src/js/pos_return.js @@ -131,6 +131,7 @@ models.PosModel = models.PosModel.extend({ var self = this; var new_order = {}; var orders_list = self.pos_orders; + for (var i in orders) { var partners = self.partners; var partner = ""; @@ -459,7 +460,9 @@ var OrderSuper = models.Order; models.Order = models.Order.extend({ initialize: function(attributes,options){ var order = OrderSuper.prototype.initialize.call(this, attributes,options); - order.return_ref = ''; + if (typeof(order) != 'undefined'){ + order.return_ref = ' ' + } return order; }, init_from_JSON: function(json) {