From 520444f70c1440aedd2727dcf5d75fcf098e1cc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 24 Oct 2006 15:52:01 +0000
Subject: [PATCH] More guessing of the account_type based on gap

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10916 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../M9AccountTypeConstraint.py                |  4 +++
 bt5/erp5_accounting_l10n_fr_m9/bt/revision    |  2 +-
 .../ERP5/tests/testAccounting_l10n_fr_m9.py   | 26 +++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/bt5/erp5_accounting_l10n_fr_m9/ConstraintTemplateItem/M9AccountTypeConstraint.py b/bt5/erp5_accounting_l10n_fr_m9/ConstraintTemplateItem/M9AccountTypeConstraint.py
index f8f4880813..bfc5f957a0 100644
--- a/bt5/erp5_accounting_l10n_fr_m9/ConstraintTemplateItem/M9AccountTypeConstraint.py
+++ b/bt5/erp5_accounting_l10n_fr_m9/ConstraintTemplateItem/M9AccountTypeConstraint.py
@@ -40,6 +40,10 @@ class M9AccountTypeConstraint(AccountTypeConstraint):
     ('gap/fr/m9/4/41', ('asset/receivable', )),
     ('gap/fr/m9/4/42', ('liability/payable', )),
     ('gap/fr/m9/4/43', ('liability/payable', )),
+    ('gap/fr/m9/4/47/471/4718', ('asset/receivable', )),
+    ('gap/fr/m9/4/47/472/4721', ('liability/payable', )),
+    ('gap/fr/m9/4/47/473/4731', ('asset/receivable', )),
+    ('gap/fr/m9/4/47/473/4735', ('liability/payable', )),
     ('gap/fr/m9/4', ('liability/payable', 'asset/receivable')),
     ('gap/fr/m9/5/59', ('asset', )),
     ('gap/fr/m9/5', ('asset/cash', )),
diff --git a/bt5/erp5_accounting_l10n_fr_m9/bt/revision b/bt5/erp5_accounting_l10n_fr_m9/bt/revision
index b74e882ae3..1758dddcce 100644
--- a/bt5/erp5_accounting_l10n_fr_m9/bt/revision
+++ b/bt5/erp5_accounting_l10n_fr_m9/bt/revision
@@ -1 +1 @@
-31
\ No newline at end of file
+32
\ No newline at end of file
diff --git a/product/ERP5/tests/testAccounting_l10n_fr_m9.py b/product/ERP5/tests/testAccounting_l10n_fr_m9.py
index 0b35d87c4c..5d4da673b3 100644
--- a/product/ERP5/tests/testAccounting_l10n_fr_m9.py
+++ b/product/ERP5/tests/testAccounting_l10n_fr_m9.py
@@ -224,7 +224,33 @@ class TestAccounting_l10n_M9(ERP5TypeTestCase):
                                account_type='equity')
     self.assertEquals(1, len(account.checkConsistency(fixit=1)))
     self.assertEquals('liability/payable', account.getAccountType())
+  
+  # Members of gap/fr/m9/4/47 are very specific
+  # for now, we do not fix 476 or 477
+  def test_AccountTypeConstaintFixFor4718(self):
+    account = self._getAccount('4718',
+                               gap='fr/m9/4/47/471/4718', )
+    self.assertEquals(1, len(account.checkConsistency(fixit=1)))
+    self.assertEquals('asset/receivable', account.getAccountType())
+  
+  def test_AccountTypeConstaintFixFor4721(self):
+    account = self._getAccount('4721',
+                               gap='fr/m9/4/47/472/4721', )
+    self.assertEquals(1, len(account.checkConsistency(fixit=1)))
+    self.assertEquals('liability/payable', account.getAccountType())
 
+  def test_AccountTypeConstaintFixFor4731(self):
+    account = self._getAccount('4731',
+                               gap='fr/m9/4/47/473/4731', )
+    self.assertEquals(1, len(account.checkConsistency(fixit=1)))
+    self.assertEquals('asset/receivable', account.getAccountType())
+
+  def test_AccountTypeConstaintFixFor4735(self):
+    account = self._getAccount('4735',
+                               gap='fr/m9/4/47/473/4735', )
+    self.assertEquals(1, len(account.checkConsistency(fixit=1)))
+    self.assertEquals('liability/payable', account.getAccountType())
+    
 if __name__ == '__main__':
   framework()
 else:
-- 
2.30.9