[FIX] point_of_sale: add warning for SN not set in PoS

Current behavior:
In PoS when you access payment screen with product tracked by SN
and if some of the SN are not set you have no warning.

Steps to reproduce:
- Create product tracked by SN
- Sell it in a PoS
- Don't set the SN
- Click on payment button
- No warning is displayed

Solution:
Add a warning popup to inform the user that he is going
to make a payment with missing SN

opw-2818511

closes odoo/odoo#89565

X-original-commit: c1a4b89e93207d7e18c5f7491db110f0d28ae836
Signed-off-by: Masereel Pierre <pim@odoo.com>
This commit is contained in:
roen-odoo
2022-04-25 18:15:10 +02:00
committed by Pierre Masereel
parent f9d6bda792
commit 84b847020f
2 changed files with 33 additions and 2 deletions
@@ -3092,6 +3092,7 @@ msgstr ""
#. module: point_of_sale
#. openerp-web
#: code:addons/point_of_sale/static/src/js/Chrome.js:0
#: code:addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js:0
#, python-format
msgid "No"
msgstr ""
@@ -5246,6 +5247,13 @@ msgid ""
"Cash Registers: %r"
msgstr ""
#. module: point_of_sale
#. openerp-web
#: code:addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js:0
#, python-format
msgid "Some Serial/Lot Numbers are missing"
msgstr ""
#. module: point_of_sale
#. openerp-web
#: code:addons/point_of_sale/static/src/js/Chrome.js:0
@@ -6478,7 +6486,9 @@ msgstr ""
#. module: point_of_sale
#. openerp-web
#: code:addons/point_of_sale/models/pos_config.py:0
#: code:addons/point_of_sale/static/src/js/Chrome.js:0
#: code:addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js:0
#, python-format
msgid "Yes"
msgstr ""
@@ -6498,6 +6508,15 @@ msgstr ""
msgid "You are not allowed to change this quantity"
msgstr ""
#. module: point_of_sale
#. openerp-web
#: code:addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js:0
#, python-format
msgid ""
"You are trying to sell products with serial/lot numbers, but some of them are not set.\n"
"Would you like to proceed anyway?"
msgstr ""
#. module: point_of_sale
#: code:addons/point_of_sale/models/account_bank_statement.py:0
#, python-format
@@ -353,8 +353,20 @@ odoo.define('point_of_sale.ProductScreen', function(require) {
this.currentOrder.updatePricelist(newPartner);
}
}
_onClickPay() {
this.showScreen('PaymentScreen');
async _onClickPay() {
if (this.env.pos.get_order().orderlines.some(line => line.get_product().tracking !== 'none' && !line.has_valid_product_lot()) && (this.env.pos.picking_type.use_create_lots || this.env.pos.picking_type.use_existing_lots)) {
const { confirmed } = await this.showPopup('ConfirmPopup', {
title: this.env._t('Some Serial/Lot Numbers are missing'),
body: this.env._t('You are trying to sell products with serial/lot numbers, but some of them are not set.\nWould you like to proceed anyway?'),
confirmText: this.env._t('Yes'),
cancelText: this.env._t('No')
});
if (confirmed) {
this.showScreen('PaymentScreen');
}
} else {
this.showScreen('PaymentScreen');
}
}
switchPane() {
this.state.mobile_pane = this.state.mobile_pane === "left" ? "right" : "left";