From 0f013a4982de686182e38abe37199bf536ee1e98 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Thu, 20 Jul 2017 17:37:48 +0200 Subject: [PATCH] [ADD] Make pos session available when selecting pickings --- pos_picking_load/__openerp__.py | 2 +- pos_picking_load/models/stock_picking.py | 6 +++--- pos_picking_load/static/src/js/pos_picking_load.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pos_picking_load/__openerp__.py b/pos_picking_load/__openerp__.py index f946b37b..76e5e12a 100644 --- a/pos_picking_load/__openerp__.py +++ b/pos_picking_load/__openerp__.py @@ -5,7 +5,7 @@ { 'name': 'POS Picking Load', - 'version': '8.0.1.0.0', + 'version': '8.0.1.1.0', 'author': 'GRAP,Odoo Community Association (OCA)', 'category': 'Point Of Sale', 'license': 'AGPL-3', diff --git a/pos_picking_load/models/stock_picking.py b/pos_picking_load/models/stock_picking.py index 35e7d095..afb78870 100644 --- a/pos_picking_load/models/stock_picking.py +++ b/pos_picking_load/models/stock_picking.py @@ -17,7 +17,7 @@ class StockPicking(models.Model): # Custom Section @api.model - def _prepare_filter_for_pos(self): + def _prepare_filter_for_pos(self, pos_session_id): return [ ('state', 'in', ['confirmed', 'partially_available', 'assigned']), ('invoice_state', '=', '2binvoiced'), @@ -28,12 +28,12 @@ class StockPicking(models.Model): return ['name', 'partner_id', 'min_date', 'origin'] @api.model - def search_pickings_for_pos(self, query): + def search_pickings_for_pos(self, query, pos_session_id): # Get Picking Types available for PoS picking_type_obj = self.env['stock.picking.type'] picking_types = picking_type_obj.search( [('available_in_pos', '=', True)]) - condition = self._prepare_filter_for_pos() + [ + condition = self._prepare_filter_for_pos(pos_session_id) + [ ('picking_type_id', 'in', picking_types.ids), '|', '|', ('name', 'ilike', query), diff --git a/pos_picking_load/static/src/js/pos_picking_load.js b/pos_picking_load/static/src/js/pos_picking_load.js index c5e7e11b..19710efa 100644 --- a/pos_picking_load/static/src/js/pos_picking_load.js +++ b/pos_picking_load/static/src/js/pos_picking_load.js @@ -271,7 +271,7 @@ openerp.pos_picking_load = function(instance, local) { search_pickings: function(query) { var self = this; var pickingModel = new instance.web.Model(this.model); - return pickingModel.call('search_pickings_for_pos', [query || '']) + return pickingModel.call('search_pickings_for_pos', [query || '', this.pos.pos_session.id]) .then(function (result) { self.render_list(result); }).fail(function (error, event){