From 37ceb15aa1b577728f0b79ec10bf7819ee3ed24a Mon Sep 17 00:00:00 2001
From: jordan <jordan@le-filament.com>
Date: Mon, 3 May 2021 19:34:00 +0200
Subject: [PATCH] [fix] rejet => credit * (-1)

---
 views/scop_cotisations_idf.xml    | 1 -
 views/scop_invoice_idf.xml        | 1 -
 wizard/scop_invoice_idf_wizard.py | 2 ++
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/views/scop_cotisations_idf.xml b/views/scop_cotisations_idf.xml
index bd662e1..13a6b2f 100644
--- a/views/scop_cotisations_idf.xml
+++ b/views/scop_cotisations_idf.xml
@@ -73,7 +73,6 @@
                                 <field name="currency_id" invisible="1"/>
                                 <field name="credit" widget="monetary" string="Montant" attrs="{'invisible': [('type', '=', 'inv')]}"/>
                                 <field name="debit" widget="monetary" string="Montant" attrs="{'invisible': [('type', '!=', 'inv')]}"/>
-                                <field name="debit" widget="monetary" string="Montant rejeté" attrs="{'invisible': [('type', '!=', 'reject')]}"/>
                                 <field name="amount_residual" widget="monetary"
                                        attrs="{'invisible': [('type', '!=', 'inv')]}"/>
                                 <field name="invoice_id"
diff --git a/views/scop_invoice_idf.xml b/views/scop_invoice_idf.xml
index 8492b8f..cb2df76 100644
--- a/views/scop_invoice_idf.xml
+++ b/views/scop_invoice_idf.xml
@@ -69,7 +69,6 @@
                                 <field name="currency_id" invisible="1"/>
                                 <field name="credit" widget="monetary" string="Montant" attrs="{'invisible': [('type', '=', 'inv')]}"/>
                                 <field name="debit" widget="monetary" string="Montant" attrs="{'invisible': [('type', '!=', 'inv')]}"/>
-                                <field name="debit" widget="monetary" string="Montant rejeté" attrs="{'invisible': [('type', '!=', 'reject')]}"/>
                                 <field name="amount_residual" widget="monetary"
                                        attrs="{'invisible': [('type', '!=', 'inv')]}"/>
                                 <field name="invoice_id"
diff --git a/wizard/scop_invoice_idf_wizard.py b/wizard/scop_invoice_idf_wizard.py
index 186fc9d..4428605 100644
--- a/wizard/scop_invoice_idf_wizard.py
+++ b/wizard/scop_invoice_idf_wizard.py
@@ -136,6 +136,8 @@ class ScopImportIDFWizard(models.TransientModel):
                                 line_type = "pay"
                             elif journal == "BFC" and debit > 0:
                                 line_type = "reject"
+                                credit = debit * (-1)
+                                debit = 0
                             else:
                                 line_type = "refund"
 
-- 
GitLab