From c53c5423f09982ec9eaf4cf92a5277264be1093e Mon Sep 17 00:00:00 2001 From: "Ronald Portier (Therp BV)" Date: Sat, 13 Jun 2015 01:20:18 +0200 Subject: [PATCH] Support zip files. --- .../__manifest__.py | 2 +- account_bank_statement_import_camt/camt.py | 9 +++++- .../test_files/test-camt053.xml | 30 +++++++++--------- .../test_files/test-camt053.zip | Bin 0 -> 3111 bytes .../tests/test_import_bank_statement.py | 11 +++++-- 5 files changed, 33 insertions(+), 19 deletions(-) create mode 100644 account_bank_statement_import_camt/test_files/test-camt053.zip diff --git a/account_bank_statement_import_camt/__manifest__.py b/account_bank_statement_import_camt/__manifest__.py index a59c096..86ce0c5 100644 --- a/account_bank_statement_import_camt/__manifest__.py +++ b/account_bank_statement_import_camt/__manifest__.py @@ -19,7 +19,7 @@ ############################################################################## { 'name': 'CAMT Format Bank Statements Import', - 'version': '8.0.0.3.0', + 'version': '8.0.0.4.0', 'license': 'AGPL-3', 'author': 'Odoo Community Association (OCA), Therp BV', 'website': 'https://github.com/OCA/bank-statement-import', diff --git a/account_bank_statement_import_camt/camt.py b/account_bank_statement_import_camt/camt.py index 96e7a51..aed01db 100644 --- a/account_bank_statement_import_camt/camt.py +++ b/account_bank_statement_import_camt/camt.py @@ -69,7 +69,7 @@ class CamtParser(object): './ns:RmtInf/ns:Ustrd', './ns:AddtlTxInf', './ns:AddtlNtryInf', - ], transaction, 'message') + ], transaction, 'message', join_str='\n') # eref self.add_value_from_node( ns, node, [ @@ -137,6 +137,13 @@ class CamtParser(object): if not transaction.message: self.add_value_from_node( ns, node, './ns:AddtlNtryInf', transaction, 'message') + if not transaction.eref: + self.add_value_from_node( + ns, node, [ + './ns:NtryDtls/ns:Btch/ns:PmtInfId', + ], + transaction, 'eref' + ) transaction.data = etree.tostring(node) return transaction diff --git a/account_bank_statement_import_camt/test_files/test-camt053.xml b/account_bank_statement_import_camt/test_files/test-camt053.xml index 1d74d81..4a2a047 100644 --- a/account_bank_statement_import_camt/test_files/test-camt053.xml +++ b/account_bank_statement_import_camt/test_files/test-camt053.xml @@ -2,15 +2,15 @@ TESTBANK/NL/1420561226673 - 2013-01-06T16:20:26.673Z + 2014-01-06T16:20:26.673Z 1234Test/1 2 - 2013-01-06T16:20:26.673Z + 2014-01-06T16:20:26.673Z - 2013-01-05T00:00:00.000Z - 2013-01-05T23:59:59.999Z + 2014-01-05T00:00:00.000Z + 2014-01-05T23:59:59.999Z @@ -32,7 +32,7 @@ 15568.27 CRDT
-
2013-01-05
+
2014-01-05
@@ -44,7 +44,7 @@ 15121.12 CRDT
-
2013-01-05
+
2014-01-05
@@ -52,10 +52,10 @@ DBIT BOOK -
2013-01-05
+
2014-01-05
-
2013-01-05
+
2014-01-05
@@ -104,9 +104,9 @@ - Insurance policy 857239PERIOD 01.01.2013 - 31.12.2013 + Insurance policy 857239PERIOD 01.01.2014 - 31.12.2014 - MKB Insurance 859239PERIOD 01.01.2013 - 31.12.2013 + MKB Insurance 859239PERIOD 01.01.2014 - 31.12.2014
@@ -116,10 +116,10 @@ true BOOK -
2013-01-05
+
2014-01-05
-
2013-01-05
+
2014-01-05
@@ -182,10 +182,10 @@ CRDT BOOK -
2013-01-05
+
2014-01-05
-
2013-01-05
+
2014-01-05
@@ -202,7 +202,7 @@ - INNDNL2U20130105000217200000708 + INNDNL2U20140105000217200000708 115 diff --git a/account_bank_statement_import_camt/test_files/test-camt053.zip b/account_bank_statement_import_camt/test_files/test-camt053.zip new file mode 100644 index 0000000000000000000000000000000000000000..ccf5b3c2ba72ad03cc137edcf2ee55f67b7a2952 GIT binary patch literal 3111 zcmeH}=T{S08pZ=5FccF7R764P14xk;5EP_{0RmY=5O4w{AVr!$C=oHlAWJhyReBE! zAqJ!U#$s;Q+O;qQmC7X$#CFp;S53XKp3 z@bIyK0Kng`kJ*<4=k&#UW|xqT(@Tov5YUyorl#QtnL>GL823Dkl9(M6fc0cI%(|Ni z6Q^GLcu71wsM2}%?CvjH!8b!s<&9$V%#|&29fp7$*Z6H3|gs9r@Iab`}w zn70^AGxt!43sw21&ugEeu5!s zB=aSvS|O$Bs(_1W`3N!7kW{?C+9uvd?a-AuvRv(>X!goeIdlV;b{mCeyP1vK$0=9p zhvGziT|Owbw0q_obsli0rv4Sr^-c(wMC`04QcZhDwWKHp@XFHQlHEbhsWMKSBZZOw zA}>C4#%A3WrP-sj`HDO4lA-;!yrBVX&3%#eOMKMU@+IV(nv7lhYS%{;$3{6@D@-?8 zj%$0W-f~sSJ^sQi^P9;MO$$IZFznJn;)6b5Ft;O?XIp3Wvr?Mxgx4Co_F1d*^z6>W z16A~WLf`!H5cIp~GA4ZCR{`G`WEw$zws*gec}$;&fZM zo5o5(B`9uG=!A2Ina*WDMms&g&>^6!qHt5;GqTVR1>*Ec+Z)I*wlOs-1v{7k(SD7cx&3TX>4UUU|z4aL*H}d*MEMlY`)`QpML{Lh>UZ>Y$ z#RRHb?tB{p^?Uws=MQd|l>2$Th%nhp47tF`Rx7B!RoxbGo{x9Ijt)~YQ+V444% zPzs&KG$xTJ)T2(Qz^8|QRB}mXgGS2uVz8>+^ZoN75^~j6MqhVW51<$wUzWDyF|J1 zirME@jT#|^OHAAz3aV0H+~Jxv^`tk-VY6f-Rl*g=@Y-F-Ba{e9gU80nOv-XmG14&C zV(E)5%on5Y=I7h_Gab0duA42{ST}8V<9on@o5adK;Lj4$TmL;iTZRlaNcE zF1&6LTv;hka~iWF8};~H>r~tMthOl-2An0f&eCUPY+h! z>c3ZOHlMoCRY`(}DnQqY19eBIViuA`HhKm_r5I4{dR+8rdB$SfS*>Oa_D7-8&b&W) z{U@*guX)YGD-Hakf-SLEya527J(Uu_PrqBYLI0@RzhO7R`d`NX9R>ex{Ae#A{?quM b!LVoiJE4HE2JwIY3-8{k*?V1uzi)p7q~E=A literal 0 HcmV?d00001 diff --git a/account_bank_statement_import_camt/tests/test_import_bank_statement.py b/account_bank_statement_import_camt/tests/test_import_bank_statement.py index 8a1694f..d14aca9 100644 --- a/account_bank_statement_import_camt/tests/test_import_bank_statement.py +++ b/account_bank_statement_import_camt/tests/test_import_bank_statement.py @@ -31,11 +31,10 @@ class TestImport(TestStatementFile): { 'remote_account': 'NL46ABNA0499998748', 'transferred_amount': -754.25, - 'value_date': '2013-01-05', + 'value_date': '2014-01-05', 'ref': '435005714488-ABNO33052620', }, ] - # statement name is account number + '-' + date of last 62F line: self._test_statement_import( 'account_bank_statement_import_camt', 'test-camt053.xml', '1234Test/1', @@ -43,3 +42,11 @@ class TestImport(TestStatementFile): start_balance=15568.27, end_balance=15121.12, transactions=transactions ) + + def test_zip_import(self): + """Test import of multiple statements from zip file.""" + self._test_statement_import( + 'account_bank_statement_import_camt', 'test-camt053.zip', + '1234Test/2', # Only name of first statement + local_account='NL77ABNA0574908765', + )