From 6bd547a4e15043bed8ca1070e2d506f898bfa61e Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Wed, 6 Apr 2022 11:16:30 +0000 Subject: [PATCH] [IMP] sale_project: display 5 sales order items in Sales section Before this commit, by default 10 sales order items are shown in the Sales section displayed in the right side panel of project update view. This section takes much place when there are 10 rows by default. This commit reduces the number of Sales Order Items to 5 records to display by default when the user arrives in the project update view with the right side panel. By the way, if the user wants to see more Sales Order Items, he can click on "Load More" button to see 5 additional Sales Order Items. task-2814466 Part-of: odoo/odoo#88219 --- addons/sale_project/models/project.py | 2 +- .../sale_project/static/src/right_panel/project_right_panel.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale_project/models/project.py b/addons/sale_project/models/project.py index 6ec8142f33d..1d5f4d694fb 100644 --- a/addons/sale_project/models/project.py +++ b/addons/sale_project/models/project.py @@ -285,7 +285,7 @@ class Project(models.Model): domain = self.sudo()._get_sale_items_domain() return { 'total': self.env['sale.order.line'].sudo().search_count(domain), - 'data': self.get_sale_items_data(domain, limit=10, with_action=with_action), + 'data': self.get_sale_items_data(domain, limit=5, with_action=with_action), } def _show_profitability(self): diff --git a/addons/sale_project/static/src/right_panel/project_right_panel.js b/addons/sale_project/static/src/right_panel/project_right_panel.js index d186ce196f7..dc2ceafccd4 100644 --- a/addons/sale_project/static/src/right_panel/project_right_panel.js +++ b/addons/sale_project/static/src/right_panel/project_right_panel.js @@ -7,7 +7,7 @@ patch(ProjectRightPanel.prototype, '@sale_project/right_panel/project_right_pane async _loadAdditionalSalesOrderItems() { const offset = this.state.data.sale_items.data.length; const totalRecords = this.state.data.sale_items.total; - const limit = totalRecords - offset <= 10 ? totalRecords - offset : 10; + const limit = totalRecords - offset <= 5 ? totalRecords - offset : 5; const saleOrderItems = await this.rpc({ model: 'project.project', method: 'get_sale_items_data',