From 878ce769a06ab18b3226e90ee8207f4df482411c Mon Sep 17 00:00:00 2001
From: benjamin <benjamin@le-filament.com>
Date: Wed, 22 Jun 2022 16:17:11 +0200
Subject: [PATCH] [update] invoice tree view + add pre-commit

---
 report/scop_contribution_report.py          |  2 +-
 views/account_move.xml                      | 33 ++++++++++++---------
 views/account_payment_order.xml             | 26 ++++++++--------
 wizard/account_payment_line_create.py       |  2 +-
 wizard/account_payment_line_create_view.xml | 21 ++++++++-----
 5 files changed, 48 insertions(+), 36 deletions(-)
 mode change 100755 => 100644 wizard/account_payment_line_create.py
 mode change 100755 => 100644 wizard/account_payment_line_create_view.xml

diff --git a/report/scop_contribution_report.py b/report/scop_contribution_report.py
index b1471ab..bea7834 100644
--- a/report/scop_contribution_report.py
+++ b/report/scop_contribution_report.py
@@ -208,7 +208,7 @@ class ScopContributionReport(models.Model):
                         "credit": p.credit,
                         "class": "",
                     }
-                    if not p.move_id.move_type in ("out_invoice", "out_refund")
+                    if p.move_id.move_type not in ("out_invoice", "out_refund")
                     else {
                         "date": p.date,
                         "name": p.name,
diff --git a/views/account_move.xml b/views/account_move.xml
index 17392d2..bfd15b4 100644
--- a/views/account_move.xml
+++ b/views/account_move.xml
@@ -43,17 +43,17 @@
                     <attribute name="string">Date de cotisation</attribute>
                 </xpath>
                 <xpath expr="//field[@name='user_id']" position="attributes">
-                    <attribute name="invisible">True</attribute>
+                    <attribute name="invisible">1</attribute>
                 </xpath>
                 <xpath expr="//field[@name='team_id']" position="attributes">
-                    <attribute name="invisible">True</attribute>
+                    <attribute name="invisible">1</attribute>
                 </xpath>
 
                 <xpath expr="//field[@name='beneficiary_id']" position="attributes">
-                    <attribute name="invisible">True</attribute>
+                    <attribute name="invisible">1</attribute>
                 </xpath>
                 <xpath expr="//field[@name='team_id']" position="attributes">
-                    <attribute name="invisible">True</attribute>
+                    <attribute name="invisible">1</attribute>
                 </xpath>
             </field>
         </record>
@@ -70,24 +70,29 @@
                     position="before"
                 >
                     <field name="partner_member_number" readonly="1" />
-                </xpath>
-                <xpath
-                    expr="//field[@name='invoice_partner_display_name'][2]"
-                    position="attributes"
-                >
-                    <attribute name="string">Adhérent</attribute>
+                    <field
+                        name="invoice_partner_display_name"
+                        string="Adhérent"
+                        option="show"
+                    />
+                    <field
+                        name="invoice_date"
+                        string="Date de cotisation"
+                        option="show"
+                    />
                 </xpath>
                 <xpath expr="//field[@name='invoice_origin']" position="after">
                     <field name="type_contribution_id" optional="hide" />
+                    <field name="year" optional="hide" />
                 </xpath>
-                <xpath expr="//field[@name='invoice_date']" position="attributes">
-                    <attribute name="string">Date de cotisation</attribute>
+                <xpath expr="//field[@name='activity_ids']" position="attributes">
+                    <attribute name="optional">hide</attribute>
                 </xpath>
                 <xpath expr="//field[@name='company_id']" position="attributes">
-                    <attribute name="invisible">True</attribute>
+                    <attribute name="optional">hide</attribute>
                 </xpath>
                 <xpath expr="//field[@name='invoice_origin']" position="attributes">
-                    <attribute name="invisible">True</attribute>
+                    <attribute name="optional">hide</attribute>
                 </xpath>
                 <xpath expr="//field[@name='state']" position="after">
                     <field name="is_sdd" invisible="1" />
diff --git a/views/account_payment_order.xml b/views/account_payment_order.xml
index d73a898..e608570 100644
--- a/views/account_payment_order.xml
+++ b/views/account_payment_order.xml
@@ -53,19 +53,21 @@
                 </xpath>
                 <!-- Boutons de vérification IBAN et mandats -->
                 <xpath expr="//notebook" position="before">
-                    <field name="mandate_validity" invisible="1"/>
-                    <button name="view_wrong_iban"
-                            type="object"
-                            string="Voir les IBAN à corriger"
-                            class="btn-danger"
-                            attrs="{'invisible': [('sepa', '=', True)]}"
-                            style="margin-right: 10px;"
+                    <field name="mandate_validity" invisible="1" />
+                    <button
+                        name="view_wrong_iban"
+                        type="object"
+                        string="Voir les IBAN à corriger"
+                        class="btn-danger"
+                        attrs="{'invisible': [('sepa', '=', True)]}"
+                        style="margin-right: 10px;"
                     />
-                    <button name="view_wrong_mandate"
-                            type="object"
-                            string="Voir les Mandats non valides"
-                            class="btn-danger"
-                            attrs="{'invisible': [('mandate_validity', '=', True)]}"
+                    <button
+                        name="view_wrong_mandate"
+                        type="object"
+                        string="Voir les Mandats non valides"
+                        class="btn-danger"
+                        attrs="{'invisible': [('mandate_validity', '=', True)]}"
                     />
                 </xpath>
                 <!-- Affichage des fichers XML -->
diff --git a/wizard/account_payment_line_create.py b/wizard/account_payment_line_create.py
old mode 100755
new mode 100644
index b7e39f6..733a929
--- a/wizard/account_payment_line_create.py
+++ b/wizard/account_payment_line_create.py
@@ -1,7 +1,7 @@
 # © 2020 Le Filament (<http://www.le-filament.com>)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
 
-from odoo import models, fields, api, _
+from odoo import fields, models
 
 
 class AccountPaymentLineCreate(models.TransientModel):
diff --git a/wizard/account_payment_line_create_view.xml b/wizard/account_payment_line_create_view.xml
old mode 100755
new mode 100644
index 5faf1d6..eebf120
--- a/wizard/account_payment_line_create_view.xml
+++ b/wizard/account_payment_line_create_view.xml
@@ -1,21 +1,26 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8" ?>
 <odoo>
     <data>
         <record id="account_payment_line_create_form" model="ir.ui.view">
             <field name="name">account_payment_line_create.form</field>
             <field name="model">account.payment.line.create</field>
-            <field name="inherit_id" ref="account_payment_order.account_payment_line_create_form"/>
+            <field
+                name="inherit_id"
+                ref="account_payment_order.account_payment_line_create_form"
+            />
             <field name="arch" type="xml">
                 <xpath expr="//field[@name='due_date']" position="before">
-                    <field name="start_date"
-                           attrs="{'invisible': [('date_type', '!=', 'due')]}"
+                    <field
+                        name="start_date"
+                        attrs="{'invisible': [('date_type', '!=', 'due')]}"
                     />
                 </xpath>
                 <xpath expr="//field[@name='journal_ids']" position="after">
-                    <field name="ur_ids"
-                           widget="many2many_tags"
-                           options="{'no_create': 1, 'no_edit': 1}"
-                           placeholder="Laisser vide pour toutes les UR"
+                    <field
+                        name="ur_ids"
+                        widget="many2many_tags"
+                        options="{'no_create': 1, 'no_edit': 1}"
+                        placeholder="Laisser vide pour toutes les UR"
                     />
                 </xpath>
             </field>
-- 
GitLab