Browse Source

[MIG] pos_lot_selection: Migration to 11.0

pull/285/head
Ignacio Ales 6 years ago
committed by Nacho Alés López
parent
commit
e85e166d26
  1. 3
      pos_lot_selection/README.rst
  2. 1
      pos_lot_selection/__init__.py
  3. 3
      pos_lot_selection/__manifest__.py
  4. 2
      pos_lot_selection/static/src/js/chrome.js
  5. 25
      pos_lot_selection/static/src/js/models.js

3
pos_lot_selection/README.rst

@ -34,7 +34,7 @@ Usage
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/184/10.0
:target: https://runbot.odoo-community.org/runbot/184/11.0
Known issues / Roadmap
======================
@ -63,6 +63,7 @@ Contributors
* David <david.vidal@tecnativa.com>
* (https://www.tecnativa.com)
* Ignacio Ales <ignacio.ales@guadaltech.es>
Do not contact contributors directly about support or help with technical issues.

1
pos_lot_selection/__init__.py

@ -1 +0,0 @@
# -*- coding: utf-8 -*-

3
pos_lot_selection/__manifest__.py

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Tecnativa S.L. - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'POS Lot Selection',
'version': '10.0.1.0.0',
'version': '11.0.1.0.0',
'category': 'Point of Sale',
'author': 'Tecnativa,'
'Odoo Community Association (OCA)',

2
pos_lot_selection/static/src/js/chrome.js

@ -53,7 +53,7 @@ odoo.define("pos_lot_selection.chrome", function (require) {
}
}
}
}
};
this.gui.popup_instances.packlotline = packlotline;
return res;
},

25
pos_lot_selection/static/src/js/models.js

@ -5,25 +5,24 @@ odoo.define("pos_lot_selection.models", function (require) {
"use strict";
var models = require("point_of_sale.models");
var Model = require("web.DataModel");
var session = require("web.session");
models.PosModel = models.PosModel.extend({
get_lot: function(product, location_id) {
get_lot: function (product, location_id) {
var done = new $.Deferred();
session.rpc("/web/dataset/search_read", {
"model": "stock.quant",
"domain": [
["location_id", "=", location_id],
["product_id", "=", product],
["lot_id", "!=", false]],
["lot_id", "!=", false]]
}, {'async': false}).then(function (result) {
var product_lot = [];
if (result.length) {
for (var i = 0; i < result.length; i++) {
product_lot.push({
'lot_name': result.records[i].lot_id[1],
'qty': result.records[i].qty,
'quantity': result.records[i].quantity,
});
}
}
@ -39,16 +38,16 @@ odoo.define("pos_lot_selection.models", function (require) {
var done = new $.Deferred();
var compute_lot_lines = _orderline_super.compute_lot_lines.apply(this, arguments);
this.pos.get_lot(this.product.id, this.pos.config.stock_location_id[0])
.then(function (product_lot) {
var lot_name = [];
for (var i = 0; i < product_lot.length; i++) {
if (product_lot[i].qty >= compute_lot_lines.order_line.quantity) {
lot_name.push(product_lot[i].lot_name);
.then(function (product_lot) {
var lot_name = Object.keys(product_lot);
for (var i = 0; i < lot_name.length; i++) {
if (product_lot[lot_name[i]] < compute_lot_lines.order_line.quantity) {
lot_name.splice(i, 1);
}
}
}
compute_lot_lines.lot_name = lot_name;
done.resolve(compute_lot_lines);
});
compute_lot_lines.lot_name = lot_name;
done.resolve(compute_lot_lines);
});
return compute_lot_lines;
},
});

Loading…
Cancel
Save