[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
This commit is contained in:
Xavier BOL (xbo)
2022-04-08 17:13:29 +02:00
parent ad4b334789
commit 6bd547a4e1
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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):
@@ -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',