[FIX] pos_self_order: avoid unnecessary rpc when changing quantity
When changing quantity of a menu order line (from combo product), multiple (number of components + 1) rpcs are made. It makes sense that when incrementing a menu order line, the components are also incremented. We, however, make the rpc whenever one of the line's quantity is incremented. This commit extracts the incrementer, and we only make the rpc when the incrementer method is done incrementing all the components. Part-of: odoo/odoo#139915
This commit is contained in:
@@ -152,7 +152,7 @@ export class CartPage extends Component {
|
||||
await this.selfOrder.getPricesFromServer();
|
||||
}
|
||||
|
||||
async changeQuantity(line, increase) {
|
||||
async _changeQuantity(line, increase) {
|
||||
if (!increase && !this.canChangeQuantity(line)) {
|
||||
return;
|
||||
}
|
||||
@@ -164,11 +164,14 @@ export class CartPage extends Component {
|
||||
increase ? line.qty++ : line.qty--;
|
||||
for (const cline of this.selfOrder.currentOrder.lines) {
|
||||
if (cline.combo_parent_uuid === line.uuid) {
|
||||
this.changeQuantity(cline, increase);
|
||||
this._changeQuantity(cline, increase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async changeQuantity(line, increase) {
|
||||
await this._changeQuantity(line, increase);
|
||||
await this.selfOrder.getPricesFromServer();
|
||||
return;
|
||||
}
|
||||
|
||||
clickOnLine(line) {
|
||||
|
||||
Reference in New Issue
Block a user