From 4aa4facdaee9683a2917c72c6695cc5ff28e1463 Mon Sep 17 00:00:00 2001 From: niyasraphy Date: Thu, 13 Jul 2023 04:25:41 +0000 Subject: [PATCH] [IMP] sale: option to generate single/multiple invoice from so before this commit, if there is multiple sale order for a customer, and if we try to create new invoices for this orders from the tree view, it creates one invoices for all the orders. there will be cases, where we have to create separate invoices for each orders. after this commit, a boolean will be introduced in the wizard, by which user can decide one invoice or multiple invoice by grouping sale order. closes odoo/odoo#128351 Signed-off-by: Victor Feyens (vfe) --- addons/sale/wizard/sale_make_invoice_advance.py | 6 +++++- addons/sale/wizard/sale_make_invoice_advance_views.xml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index cbf75e6b7d1..6817ab0f6c0 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -80,6 +80,10 @@ class SaleAdvancePaymentInv(models.TransientModel): # UI display_draft_invoice_warning = fields.Boolean(compute="_compute_display_draft_invoice_warning") display_invoice_amount_warning = fields.Boolean(compute="_compute_display_invoice_amount_warning") + consolidated_billing = fields.Boolean( + string="Consolidated Billing", default=True, + help="Create one invoice for all orders related to same customer and same invoicing address" + ) #=== COMPUTE METHODS ===# @@ -191,7 +195,7 @@ class SaleAdvancePaymentInv(models.TransientModel): def _create_invoices(self, sale_orders): self.ensure_one() if self.advance_payment_method == 'delivered': - return sale_orders._create_invoices(final=self.deduct_down_payments) + return sale_orders._create_invoices(final=self.deduct_down_payments, grouped=not self.consolidated_billing) else: self.sale_order_ids.ensure_one() self = self.with_company(self.company_id) diff --git a/addons/sale/wizard/sale_make_invoice_advance_views.xml b/addons/sale/wizard/sale_make_invoice_advance_views.xml index 98088457861..abb35e72334 100644 --- a/addons/sale/wizard/sale_make_invoice_advance_views.xml +++ b/addons/sale/wizard/sale_make_invoice_advance_views.xml @@ -17,6 +17,7 @@ +