summaryrefslogtreecommitdiff
path: root/addons/point_of_sale/static/src
diff options
context:
space:
mode:
authorPierre Masereel <pim@odoo.com>2020-11-26 14:52:03 +0000
committerPierre Masereel <pim@odoo.com>2020-12-02 12:18:48 +0000
commitf9dd1d88d0d24914028464cc12b69ff0878346f8 (patch)
tree2bbd4fe595ff6d3c414d4a6a67cf7ea22d6b2793 /addons/point_of_sale/static/src
parent80c1dad6d9124da9459ce38d9e8c03e5c461c180 (diff)
[FIX] point_of_sale: handle picking type without lot usage
When you are configuring the picking type used in the point of sale to not use existing lots and not create lots, the POS still ask you to encode a lot for product tracked, and the picking created don't use existing lots in stock because no reservation is made when a picking is valaidated from point of sale. As we want to reserve only in this specific case, we are now checking the options on the picking type to reserve or not product tracked. We are also not asking anymore for lot or serial number if picking type is configured that way. OPW-2377008 closes odoo/odoo#62734 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons/point_of_sale/static/src')
-rw-r--r--addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js2
-rw-r--r--addons/point_of_sale/static/src/js/models.js9
-rw-r--r--addons/point_of_sale/static/src/xml/Screens/ProductScreen/Orderline.xml2
3 files changed, 10 insertions, 3 deletions
diff --git a/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js b/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js
index 1d83146d557..8624ec9dfd5 100644
--- a/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js
+++ b/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js
@@ -86,7 +86,7 @@ odoo.define('point_of_sale.ProductScreen', function(require) {
}
// Gather lot information if required.
- if (['serial', 'lot'].includes(product.tracking)) {
+ if (['serial', 'lot'].includes(product.tracking) && (this.env.pos.picking_type.use_create_lots || this.env.pos.picking_type.use_existing_lots)) {
const isAllowOnlyOneLot = product.isAllowOnlyOneLot();
if (isAllowOnlyOneLot) {
packLotLinesToEdit = [];
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index ed4b5318edf..419dea81dc4 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -312,6 +312,13 @@ exports.PosModel = Backbone.Model.extend({
}
},
},{
+ model: 'stock.picking.type',
+ fields: ['use_create_lots', 'use_existing_lots'],
+ domain: function(self){ return [['id', '=', self.config.picking_type_id[0]]]; },
+ loaded: function(self, picking_type) {
+ self.picking_type = picking_type[0];
+ },
+ },{
model: 'res.users',
fields: ['name','company_id', 'id', 'groups_id', 'lang'],
domain: function(self){ return [['company_ids', 'in', self.config.company_id[0]],'|', ['groups_id','=', self.config.group_pos_manager_id[0]],['groups_id','=', self.config.group_pos_user_id[0]]]; },
@@ -1868,7 +1875,7 @@ exports.Orderline = Backbone.Model.extend({
}else if(!utils.float_is_zero(price - order_line_price - orderline.get_price_extra(),
this.pos.currency.decimals)){
return false;
- }else if(this.product.tracking == 'lot') {
+ }else if(this.product.tracking == 'lot' && (this.pos.picking_type.use_create_lots || this.pos.picking_type.use_existing_lots)) {
return false;
}else if (this.description !== orderline.description) {
return false;
diff --git a/addons/point_of_sale/static/src/xml/Screens/ProductScreen/Orderline.xml b/addons/point_of_sale/static/src/xml/Screens/ProductScreen/Orderline.xml
index fdd78d7b634..a285af942d0 100644
--- a/addons/point_of_sale/static/src/xml/Screens/ProductScreen/Orderline.xml
+++ b/addons/point_of_sale/static/src/xml/Screens/ProductScreen/Orderline.xml
@@ -6,7 +6,7 @@
<span class="product-name">
<t t-esc="props.line.get_full_product_name()"/>
<span> </span>
- <t t-if="props.line.get_product().tracking!=='none'">
+ <t t-if="props.line.get_product().tracking!=='none' &amp;&amp; (env.pos.picking_type.use_create_lots || env.pos.picking_type.use_existing_lots)">
<t t-if="props.line.has_valid_product_lot()">
<i t-on-click.stop="lotIconClicked"
class="oe_link_icon fa fa-list oe_icon line-lot-icon oe_green"