[FIX] point_of_sale : Removing orderline

Steps to reproduce:
	1- Install POS module and French Localization
	2- Open a session in POS
	3- Add an item to the order then remove it and set the quantity to 0

Current behavior before PR:
When you try to remove an item from POS while using french localization it gives an error 'null exception'. This happens because we are trying to set the quantity to the order after unlinking the order line and setting the order with null.

Desired behavior after PR is merged:
The error pop-up is not there anymore and you can remove any item. Now we set the new quantity to the order before unlinking the order to avoid the null exception

opw-3607956

closes odoo/odoo#144592

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
Youssef Bashandy
2023-12-06 12:42:22 +00:00
parent 161e93fb88
commit 8699231bc8
@@ -363,10 +363,10 @@ export class ProductScreen extends ControlButtonsMixin(Component) {
return true;
}
if (newQuantity >= selectedLine.saved_quantity) {
selectedLine.set_quantity(newQuantity);
if (newQuantity == 0) {
order._unlinkOrderline(selectedLine);
}
selectedLine.set_quantity(newQuantity);
return true;
}
const newLine = selectedLine.clone();