From 6030985caa242934de382c2801fa7bc67ee70450 Mon Sep 17 00:00:00 2001
From: lee <lee@le-filament.com>
Date: Mon, 7 Nov 2022 10:59:19 +0100
Subject: [PATCH] [FIX] legicoop_timsheet :  -fixed order not updating when
 using Group By  -added date_time desc by default [FIX] legicoop_invoice : 
 -fixed totals not showing when using Group By  -replaced TTC amount with
 amount HT  in Dashboard Kanban

---
 i18n/fr.po                          | 22 ++++++++++++++++++++++
 models/__init__.py                  |  1 +
 models/account_journal_dashboard.py | 28 ++++++++++++++++++++++++++++
 views/account_invoice_views.xml     | 25 +++++++++++++++++++++++++
 4 files changed, 76 insertions(+)
 create mode 100644 i18n/fr.po
 create mode 100644 models/account_journal_dashboard.py

diff --git a/i18n/fr.po b/i18n/fr.po
new file mode 100644
index 0000000..25b5969
--- /dev/null
+++ b/i18n/fr.po
@@ -0,0 +1,22 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * account
+# 
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2019-11-14 07:33+0000\n"
+"PO-Revision-Date: 2018-08-24 09:14+0000\n"
+"Last-Translator: Thomas Deleval <thd@odoo.com>, 2021\n"
+"Language-Team: French (https://www.transifex.com/odoo/teams/41243/fr/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: fr\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#. module: account
+#: model_terms:ir.ui.view,arch_db:account.account_journal_dashboard_kanban_view
+msgid "Invoices to Validate"
+msgstr "Factures à valider (HT)"
diff --git a/models/__init__.py b/models/__init__.py
index 74f1a87..0acdefe 100644
--- a/models/__init__.py
+++ b/models/__init__.py
@@ -2,3 +2,4 @@
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
 
 from . import account_invoice
+from . import account_journal_dashboard
diff --git a/models/account_journal_dashboard.py b/models/account_journal_dashboard.py
new file mode 100644
index 0000000..6564e78
--- /dev/null
+++ b/models/account_journal_dashboard.py
@@ -0,0 +1,28 @@
+# Copyright 2022 Le Filament (<http://www.le-filament.com>)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+from odoo import models
+
+
+class AccountJournal(models.Model):
+    _inherit = "account.journal"
+
+    def _get_draft_bills_query(self):
+        """
+        Surcharger pour prendre amount_untaxed_signed (Stored=True) et non
+        amount_untaxed_invoice_signed (pas Stored).
+        Ce qui permet d'afficher les sommes lors de la regroupement
+        """
+        return (
+            """
+            SELECT
+                state,
+                amount_untaxed_signed AS amount_total,
+                inv.currency_id AS currency,
+                inv.type,
+                inv.date_invoice,
+                inv.company_id
+            FROM account_invoice inv
+            WHERE journal_id = %(journal_id)s AND state = 'draft';""",
+            {"journal_id": self.id},
+        )
diff --git a/views/account_invoice_views.xml b/views/account_invoice_views.xml
index c462f86..72b6d20 100644
--- a/views/account_invoice_views.xml
+++ b/views/account_invoice_views.xml
@@ -19,5 +19,30 @@
                 </xpath>
             </field>
         </record>
+
+        <record id="legicoop_invoice_tree" model="ir.ui.view">
+            <field name="name">legicoop.account.invoice.tree</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_tree" />
+            <field name="arch" type="xml">
+                <xpath
+                    expr="//field[@name='amount_untaxed_invoice_signed']"
+                    position="attributes"
+                >
+                    <attribute name="invisible">1</attribute>
+                </xpath>
+                 <xpath
+                    expr="//field[@name='amount_untaxed_invoice_signed']"
+                    position="before"
+                >
+                     <field
+                        name="amount_untaxed_signed"
+                        string="Total HT"
+                        sum="Total HT"
+                    />
+                </xpath>
+            </field>
+        </record>
+
     </data>
 </odoo>
-- 
GitLab