Browse Source

Merge pull request #191 from StefanRijnhart/8.0-pos_picking_load_pos_session

[ADD] Make pos session available when selecting pickings
pull/192/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
3e6c4e21f2
  1. 2
      pos_picking_load/__openerp__.py
  2. 6
      pos_picking_load/models/stock_picking.py
  3. 2
      pos_picking_load/static/src/js/pos_picking_load.js

2
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',

6
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),

2
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){

Loading…
Cancel
Save