[IMP] point_of_sale: automatically refresh amount due

Before, when the amount due of a customer changed, the user
had to press the "rotating arrows" icon at the client list
screen in order for the the updated quantity to be displayed
properly.

This icon was confusing for the user and was burdening the UI
with not frequently used behaviour. Instead, in this commit,
we incorporate the `refreshTotalDue` logic in the payment
workflow so that it is updated automatically when the total
due of a client changes.

task-2669747

Part-of: odoo/odoo#81226
This commit is contained in:
Eleftherios Kritsotakis
2022-06-02 18:58:06 +02:00
committed by Pierre Masereel
parent 3e8ae40d05
commit 33b59fd616
@@ -980,6 +980,16 @@ class PosGlobalState extends PosModel {
});
this._loadProductProduct(product);
}
async refreshTotalDueOfPartner(partner) {
const partnerWithUpdatedTotalDue = await this.env.services.rpc({
model: 'res.partner',
method: 'search_read',
fields: ['total_due'],
domain: [['id', '=', partner.id]],
});
this.db.update_partners(partnerWithUpdatedTotalDue);
return partnerWithUpdatedTotalDue;
}
}
PosGlobalState.prototype.electronic_payment_interfaces = {};
Registries.Model.add(PosGlobalState);