From 0bb11f2d77a9f59c3e4f8f4552e081623a9b76f9 Mon Sep 17 00:00:00 2001
From: jordan <jordan@le-filament.com>
Date: Tue, 8 Feb 2022 17:09:28 +0100
Subject: [PATCH] [update] add field source to deal with multiple modules for
 report invoice

---
 report/account_invoice_all.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/report/account_invoice_all.py b/report/account_invoice_all.py
index 0eb4ac0..b55677a 100644
--- a/report/account_invoice_all.py
+++ b/report/account_invoice_all.py
@@ -27,6 +27,10 @@ class AccountInvoiceReport(models.Model):
         ('paid', 'Payée'),
         ('cancel', 'Annulée')
         ], string='Statut', readonly=True)
+    source = fields.Selection(
+        string='Source',
+        selection=[('odoo', 'Odoo')],
+        required=True,)
     date_due = fields.Date(string='Date échéance', readonly=True)
     residual_company_signed = fields.Float(string='Montant dû', readonly=True)
     amount_total_signed = fields.Float(string='Total TTC', readonly=True)
@@ -52,6 +56,7 @@ class AccountInvoiceReport(models.Model):
         select_str = """
             SELECT
                 ROW_NUMBER() OVER(ORDER BY c.date_invoice, c.partner_id) AS id,
+                c.source,
                 c.invoice_id,
                 c.date_invoice,
                 c.date_due,
@@ -72,6 +77,7 @@ class AccountInvoiceReport(models.Model):
     def _subquery(self):
         select_str = """
                 (SELECT
+                    'odoo' as source,
                     id AS invoice_id,
                     date_invoice,
                     date_due,
@@ -107,7 +113,7 @@ class AccountInvoiceReport(models.Model):
     @api.multi
     def _compute_lines(self):
         for inv in self:
-            if inv.invoice_id:
+            if inv.source == 'odoo' and inv.invoice_id:
                 inv.lines = "<table class='table table-hover table-striped table-sm'>"\
                             "<thead class='thead-light'><tr><th>Description</th><th>Quantité</th><th>P.U</th>"\
                             "<th>Total HT</th><th>Total TTC</th></tr></thead><tbody>" + \
-- 
GitLab