[FIX] sale: make update all widget work in batch

Before this commit, all the changes were applied to the line one by one.

X-original-commit: 68d3c308df15fccf8e132a2a6ba02542a961495f
Part-of: odoo/odoo#91317
This commit is contained in:
Arnaud Joset
2022-05-18 12:00:03 +02:00
parent 5a2462fd6a
commit 5df841123d
@@ -23,14 +23,20 @@ odoo.define('sale.SaleOrderFormController', function (require) {
* (3) value is the same in all other sale order line
*/
_onOpenUpdateAllWizard(ev) {
const orderLines = this._DialogReady(ev, 'normal')
const orderLines = this._DialogReady(ev, 'normal');
const customValuesCommands = [];
const confirmCallback = () => {
orderLines.slice(1).forEach((line) => {
this.trigger_up('field_changed', {
dataPointID: this.renderer.state.id,
changes: {order_line: {operation: "UPDATE", id: line.id, data: {[ev.data.fieldName]: ev.data.value}}},
customValuesCommands.push({
operation: "UPDATE",
id: line.id,
data: {[ev.data.fieldName]: ev.data.value},
});
});
this.trigger_up('field_changed', {
dataPointID: this.renderer.state.id,
changes: {order_line: {operation: "MULTI", commands: customValuesCommands}},
});
};
if (orderLines) {
Dialog.confirm(this, _t("Do you want to apply this value to all order lines?"), {