From 3ee63f746b628bfb5427b4c75d782f6b7eda6caf Mon Sep 17 00:00:00 2001 From: FrancoisGe Date: Fri, 1 Sep 2023 16:02:26 +0200 Subject: [PATCH] [FIX] sale: groupBy and edit record in kanban catalog Before this commit, in the kanban catalog view, when you make a groupBy or update a record (click on the star), a crash is displayed. Why does this happen? The RPC for "sale_order_lines_info" is called during loadData of all dataPoint types. Solution: The RPC for "sale_order_lines_info" should only be called for DynamicRecordList. closes odoo/odoo#133907 Signed-off-by: Aaron Bohy (aab) --- .../static/src/js/product_catalog/kanban_model.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/sale/static/src/js/product_catalog/kanban_model.js b/addons/sale/static/src/js/product_catalog/kanban_model.js index 889f4842ee4..49263140fbf 100644 --- a/addons/sale/static/src/js/product_catalog/kanban_model.js +++ b/addons/sale/static/src/js/product_catalog/kanban_model.js @@ -17,12 +17,14 @@ export class ProductCatalogKanbanModel extends RelationalModel { async _loadData(params) { const result = await super._loadData(...arguments); - const saleOrderLinesInfo = await this.rpc("/sales/catalog/sale_order_lines_info", { - order_id: params.context.order_id, - product_ids: result.records.map((rec) => rec.id), - }); - for (const record of result.records) { - record.productCatalogData = saleOrderLinesInfo[record.id]; + if (!params.isMonoRecord && !params.groupBy.length) { + const saleOrderLinesInfo = await this.rpc("/sales/catalog/sale_order_lines_info", { + order_id: params.context.order_id, + product_ids: result.records.map((rec) => rec.id), + }); + for (const record of result.records) { + record.productCatalogData = saleOrderLinesInfo[record.id]; + } } return result; }