From 8804c820314cf69f1f6d2a4de20aa919c1918705 Mon Sep 17 00:00:00 2001 From: Kitti U Date: Sun, 3 Mar 2024 11:04:51 +0700 Subject: [PATCH] Some code refactor --- sale_invoice_plan/models/sale.py | 15 +++++++-------- sale_invoice_plan/views/sale_view.xml | 14 +++++++------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/sale_invoice_plan/models/sale.py b/sale_invoice_plan/models/sale.py index ce42e4fd5887..6b4096a87507 100644 --- a/sale_invoice_plan/models/sale.py +++ b/sale_invoice_plan/models/sale.py @@ -45,14 +45,13 @@ def _compute_invoice_plan_process(self): for rec in self: has_invoice_plan = rec.use_invoice_plan and rec.invoice_plan_ids to_invoice = rec.invoice_plan_ids.filtered(lambda l: not l.invoiced) - if rec.state == "sale" and has_invoice_plan and to_invoice: - if rec.invoice_status == "to invoice" or ( - rec.invoice_status == "no" - and "advance" in to_invoice.mapped("invoice_type") - ): - rec.invoice_plan_process = True - continue - rec.invoice_plan_process = False + inv_or_adv = rec.invoice_status == "to invoice" or ( + rec.invoice_status == "no" + and "advance" in to_invoice.mapped("invoice_type") + ) + rec.invoice_plan_process = ( + rec.state == "sale" and has_invoice_plan and to_invoice and inv_or_adv + ) @api.constrains("invoice_plan_ids") def _check_invoice_plan_total_percent(self): diff --git a/sale_invoice_plan/views/sale_view.xml b/sale_invoice_plan/views/sale_view.xml index 9a51323a0743..16871e433a82 100644 --- a/sale_invoice_plan/views/sale_view.xml +++ b/sale_invoice_plan/views/sale_view.xml @@ -162,31 +162,31 @@ @@ -222,7 +222,7 @@ {'search_default_draft': 1, 'search_default_sale': 1} + >{'search_default_sales': 1, 'search_default_groupby_sale': 1}

View sales invoice plan lines @@ -237,6 +237,6 @@ id="menu_sale_invoice_plan" parent="sale.sale_order_menu" groups="sales_team.group_sale_salesman" - sequence="22" + sequence="25" />