From dc39ebcc25a9e6bc3f145e2defff5af9400e3638 Mon Sep 17 00:00:00 2001
From: benjamin <benjamin@le-filament.com>
Date: Tue, 1 Mar 2022 10:50:17 +0100
Subject: [PATCH] [add] siret on onvoice pdf

---
 models/account_move.py                | 4 ++++
 templates/report_invoice_document.xml | 7 +++++++
 views/account_move.xml                | 3 +++
 3 files changed, 14 insertions(+)

diff --git a/models/account_move.py b/models/account_move.py
index 1b93bc9..cd7cda4 100644
--- a/models/account_move.py
+++ b/models/account_move.py
@@ -12,6 +12,10 @@ class AccountMove(models.Model):
         comodel_name='account.account',
         string='Compte de tiers',
     )
+    display_siret = fields.Boolean(
+        string="Afficher le SIRET", default=False,
+        help="Affiche le n° SIRET sur la facture client"
+    )
 
     # ------------------------------------------------------
     # Override Parent
diff --git a/templates/report_invoice_document.xml b/templates/report_invoice_document.xml
index e5258e7..31b040e 100644
--- a/templates/report_invoice_document.xml
+++ b/templates/report_invoice_document.xml
@@ -6,6 +6,13 @@
     <data>
 
         <template id="afac_report_invoice_document" inherit_id="account.report_invoice_document">
+            <!-- Affichage du SIRET -->
+            <xpath expr="//div[@name='reference']" position="after">
+                <div class="col-auto col-3 mw-100 mb-2" t-if="o.display_siret" name="reference">
+                    <strong>SIRET :</strong>
+                    <p class="m-0" t-field="o.partner_id.siret"/>
+                </div>
+            </xpath>
             <!-- Gestion de l'affichage de la TVA : tableau & total -->
             <xpath expr="//th[@name='th_taxes']" position="attributes">
                 <attribute name="t-if">o.company_id.is_tax</attribute>
diff --git a/views/account_move.xml b/views/account_move.xml
index b4699f8..6ef6915 100644
--- a/views/account_move.xml
+++ b/views/account_move.xml
@@ -16,6 +16,9 @@
                     <attribute name="domain">[('is_company', '=', True)]</attribute>
                     <attribute name="options">{'no_create': True}</attribute>
                 </xpath>
+                <xpath expr="//field[@name='payment_reference']" position="after">
+                    <field name="display_siret" widget="boolean_toggle"/>
+                </xpath>
                 <xpath expr="//div[@name='journal_div']" position="after">
                     <field name="third_account_journal_ids" invisible="1"/>
                     <field
-- 
GitLab