From f2f41537b0c48c721bd3e3d7e873842713b1c67e Mon Sep 17 00:00:00 2001
From: Juliana <juliana@le-filament.com>
Date: Wed, 15 Jun 2022 17:33:23 +0200
Subject: [PATCH] [ADD]Add state to account invoice

---
 models/acc_account.py       | 5 +++++
 views/acc_account_views.xml | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/models/acc_account.py b/models/acc_account.py
index aa3abed..f7055d7 100644
--- a/models/acc_account.py
+++ b/models/acc_account.py
@@ -108,6 +108,11 @@ class AccAccount(models.Model):
         "Consommation locale (index Enedis)", digits="Unité de Mesure"
     )
     url = fields.Char("URL", compute="_compute_url", store=True)
+    state = fields.Selection(selection=[
+        ('draft', 'Brouillon'),
+        ('published', 'Publié'),
+    ], string='Statut', required=True, copy=False, tracking=True,
+        default='draft')
 
     @api.model_create_multi
     def create(self, vals_list):
diff --git a/views/acc_account_views.xml b/views/acc_account_views.xml
index 9ee6353..1fa8868 100644
--- a/views/acc_account_views.xml
+++ b/views/acc_account_views.xml
@@ -191,10 +191,10 @@
             <field name="model">acc.account</field>
             <field name="arch" type="xml">
                 <form string="Facture">
+                    <header>
+                        <field name="state" widget="statusbar" options="{'clickable': '1'}" statusbar_visible="draft,published"/>
+                    </header>
                     <sheet>
-                        <!-- Payment status for invoices / receipts -->
-<!--                        <widget name="web_ribbon" title="Paid"/>-->
-                        <!-- Invisible fields -->
                         <field name="id" invisible="1" />
 
                         <div class="oe_title">
-- 
GitLab