From f7f096ed045cc86318598e66fefccc1f8d84fe96 Mon Sep 17 00:00:00 2001
From: benjamin <benjamin@le-filament.com>
Date: Tue, 12 Apr 2022 12:09:58 +0200
Subject: [PATCH] [mig] Migration 13.0

---
 .pylintrc                                          |  2 +-
 .pylintrc-mandatory                                |  2 +-
 __manifest__.py                                    |  2 +-
 .../{14.0.1.0.0 => 13.0.1.0.0}/post-migration.py   |  0
 .../{14.0.1.0.0 => 13.0.1.0.0}/pre-migration.py    |  0
 report/scop_contribution_report.py                 | 10 +++++-----
 views/account_move.xml                             | 14 +++++++-------
 views/account_payment_order.xml                    |  2 +-
 views/res_config_settings.xml                      |  2 +-
 9 files changed, 17 insertions(+), 17 deletions(-)
 rename migrations/{14.0.1.0.0 => 13.0.1.0.0}/post-migration.py (100%)
 rename migrations/{14.0.1.0.0 => 13.0.1.0.0}/pre-migration.py (100%)

diff --git a/.pylintrc b/.pylintrc
index dc6270e..542c686 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -8,7 +8,7 @@ manifest_required_authors=Le Filament
 manifest_required_keys=license
 manifest_deprecated_keys=description,active
 license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
-valid_odoo_versions=14.0
+valid_odoo_versions=13.0
 
 [MESSAGES CONTROL]
 disable=all
diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory
index 43ea239..74be5ff 100644
--- a/.pylintrc-mandatory
+++ b/.pylintrc-mandatory
@@ -8,7 +8,7 @@ manifest_required_authors=Le Filament
 manifest_required_keys=license
 manifest_deprecated_keys=description,active
 license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
-valid_odoo_versions=14.0
+valid_odoo_versions=13.0
 
 [MESSAGES CONTROL]
 disable=all
diff --git a/__manifest__.py b/__manifest__.py
index 5e73bf3..325cb4f 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -3,7 +3,7 @@
 {
     "name": "CG SCOP - Cotisations",
     "summary": "CG SCOP - Cotisations",
-    "version": "14.0.1.0.0",
+    "version": "13.0.1.0.0",
     "author": "Le Filament",
     "license": "AGPL-3",
     "application": False,
diff --git a/migrations/14.0.1.0.0/post-migration.py b/migrations/13.0.1.0.0/post-migration.py
similarity index 100%
rename from migrations/14.0.1.0.0/post-migration.py
rename to migrations/13.0.1.0.0/post-migration.py
diff --git a/migrations/14.0.1.0.0/pre-migration.py b/migrations/13.0.1.0.0/pre-migration.py
similarity index 100%
rename from migrations/14.0.1.0.0/pre-migration.py
rename to migrations/13.0.1.0.0/pre-migration.py
diff --git a/report/scop_contribution_report.py b/report/scop_contribution_report.py
index 0601eb5..af8309f 100644
--- a/report/scop_contribution_report.py
+++ b/report/scop_contribution_report.py
@@ -40,9 +40,9 @@ class ScopContributionReport(models.Model):
             "amount_total_signed",
             "amount_residual_signed",
             "state",
-            "move_type",
+            "type",
             "is_contribution",
-            "payment_state",
+            "invoice_payment_state",
         ],
     }
 
@@ -73,7 +73,7 @@ class ScopContributionReport(models.Model):
         where_str = """
             WHERE
                 i.state = 'posted'
-                AND i.move_type in ('out_invoice', 'out_refund')
+                AND i.type in ('out_invoice', 'out_refund')
                 AND i.is_contribution = true
         """
         return where_str
@@ -187,7 +187,7 @@ class ScopContributionReport(models.Model):
                 ]
             )
         )
-        refund_ids = invoice_ids.filtered(lambda i: i.move_type == "out_refund")
+        refund_ids = invoice_ids.filtered(lambda i: i.type == "out_refund")
         if refund_ids:
             return True
         else:
@@ -278,6 +278,6 @@ class ScopContributionReport(models.Model):
                 "=",
                 self.type_contribution_id.id,
             ),
-            ("move_type", "=", "out_invoice"),
+            ("type", "=", "out_invoice"),
             ("state", "=", "posted"),
         ]
diff --git a/views/account_move.xml b/views/account_move.xml
index 17392d2..2bc4bee 100644
--- a/views/account_move.xml
+++ b/views/account_move.xml
@@ -13,7 +13,7 @@
             <field name="mode">primary</field>
             <field name="inherit_id" ref="account.view_move_form" />
             <field name="arch" type="xml">
-                <xpath expr="//div[@name='journal_div']" position="after">
+                <xpath expr="//field[@name='journal_id']" position="after">
                     <field
                         name="partner_ur_id"
                         readonly="1"
@@ -120,22 +120,22 @@
                     <filter
                         name="draft"
                         string="Brouillon"
-                        domain="['|', ('state','=','draft'), ('move_type','in', ['out_invoice', 'out_refund'])]"
+                        domain="['|', ('state','=','draft'), ('type','in', ['out_invoice', 'out_refund'])]"
                     />
                     <filter
                         name="unpaid"
                         string="Non payées"
-                        domain="[('payment_state', 'in', ['not_paid', 'in_payment', 'partial']), ('state', '=', 'posted')]"
+                        domain="[('invoice_payment_state', 'in', ['not_paid', 'in_payment', 'partial']), ('state', '=', 'posted')]"
                     />
                     <filter
                         name="paid"
                         string="Payé"
-                        domain="[('payment_state', '=', 'paid'), ('state', '=', 'posted')]"
+                        domain="[('invoice_payment_state', '=', 'paid'), ('state', '=', 'posted')]"
                     />
                     <filter
                         name="late"
                         string="Retard"
-                        domain="['&amp;', ('invoice_date_due', '&lt;', time.strftime('%Y-%m-%d')), ('state', '=', 'posted'), ('payment_state', 'in', ('not_paid', 'partial'))]"
+                        domain="['&amp;', ('invoice_date_due', '&lt;', time.strftime('%Y-%m-%d')), ('state', '=', 'posted'), ('invoice_payment_state', 'in', ('not_paid', 'partial'))]"
                     />
                     <separator />
                     <filter
@@ -188,13 +188,13 @@
         <record id="account.action_move_out_invoice_type" model="ir.actions.act_window">
             <field
                 name="domain"
-                eval="[('move_type','=', 'out_invoice'), ('is_contribution', '!=', True)]"
+                eval="[('type','=', 'out_invoice'), ('is_contribution', '!=', True)]"
             />
         </record>
         <record id="account.action_move_out_refund_type" model="ir.actions.act_window">
             <field
                 name="domain"
-                eval="[('move_type','=', 'out_refund'), ('is_contribution', '!=', True)]"
+                eval="[('type','=', 'out_refund'), ('is_contribution', '!=', True)]"
             />
         </record>
 
diff --git a/views/account_payment_order.xml b/views/account_payment_order.xml
index 51df21e..c8c25ae 100644
--- a/views/account_payment_order.xml
+++ b/views/account_payment_order.xml
@@ -22,7 +22,7 @@
                     >Confirmer l'annulation de l'ordre de prélèvement ?</attribute>
                 </xpath>
                 <xpath
-                    expr="//button[@name='action_uploaded_cancel']"
+                    expr="//button[@name='action_done_cancel']"
                     position="attributes"
                 >
                     <attribute
diff --git a/views/res_config_settings.xml b/views/res_config_settings.xml
index 14380d6..129d961 100644
--- a/views/res_config_settings.xml
+++ b/views/res_config_settings.xml
@@ -9,7 +9,7 @@
             <field name="inherit_id" ref="account.res_config_settings_view_form" />
             <field name="arch" type="xml">
                 <xpath
-                    expr="//div[@name='fiscal_localization_setting_container']"
+                    expr="//div[@id='invoicing_settings']"
                     position="after"
                 >
                     <h2>Cotisations</h2>
-- 
GitLab