Maintainers
+Maintainers
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
diff --git a/account_statement_import_paypal/static/description/paypal_backoffice.png b/account_statement_import_paypal/static/description/paypal_backoffice.png
deleted file mode 100644
index a902aee1..00000000
Binary files a/account_statement_import_paypal/static/description/paypal_backoffice.png and /dev/null differ
diff --git a/account_statement_import_paypal/tests/__init__.py b/account_statement_import_paypal/tests/__init__.py
index 81608867..e6b11d18 100644
--- a/account_statement_import_paypal/tests/__init__.py
+++ b/account_statement_import_paypal/tests/__init__.py
@@ -1 +1,3 @@
-from . import test_paypal_statement_import
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from . import test_account_bank_statement_import_paypal
diff --git a/account_statement_import_paypal/tests/fixtures/activity_en.csv b/account_statement_import_paypal/tests/fixtures/activity_en.csv
new file mode 100644
index 00000000..258dedd5
--- /dev/null
+++ b/account_statement_import_paypal/tests/fixtures/activity_en.csv
@@ -0,0 +1,77 @@
+"Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Address Status","Sales Tax","Reference Txn ID","Invoice Number","Receipt ID","Balance","Contact Phone Number","Subject","Note"
+"29/12/2015","07:45:51","PST","PARTNER1","General Payment","Completed","USD","84.00","-4.25","79.75","paypal@partner1.com","paypal@my-company.com","TID1","Non-Confirmed","","","","","79.75","","",""
+"12/02/2016","13:30:31","PST","","User Initiated Currency Conversion","Completed","USD","-50.00","0.00","-50.00","paypal@my-company.com","","TID2","","","TID3","","","29.75","","",""
+"12/02/2016","13:30:31","PST","","User Initiated Currency Conversion","Completed","EUR","43.34","0.00","43.34","","paypal@my-company.com","TID3","","","TID2","","","43.34","","",""
+"09/06/2016","07:19:50","PDT","PARTNER2","Website Payment","Completed","USD","1,653.75","-73.07","1,580.68","paypal@partner2.com","paypal@my-company.com","TID4","Confirmed","","RTID1","31","RID1","1,610.43","","Payment to My Company for invoice 31",""
+"22/06/2016","02:43:36","PDT","","General Currency Conversion","Completed","USD","-78.02","0.00","-78.02","paypal@my-company.com","","TID5","","0.00","TID7","PARTNER3-INV1","","1,532.41","","Shopping Cart",""
+"22/06/2016","02:43:36","PDT","","General Currency Conversion","Completed","AUD","100.00","0.00","100.00","","paypal@my-company.com","TID6","","0.00","TID7","PARTNER3-INV1","","100.00","","Shopping Cart",""
+"22/06/2016","02:43:36","PDT","PARTNER3","Website Payment","Completed","AUD","-100.00","0.00","-100.00","paypal@my-company.com","paypal@partner3.com","TID7","Non-Confirmed","0.00","","PARTNER3-INV1","","0.00","","Shopping Cart",""
+"01/07/2016","12:23:59","PDT","PARTNER2","Website Payment","Completed","USD","2,602.50","-114.81","2,487.69","paypal@partner2.com","paypal@my-company.com","TID8","Confirmed","","RTID2","33","RID2","4,020.10","","Payment to My Company for invoice 33",""
+"06/07/2016","08:17:57","PDT","PARTNER2","Website Payment","Completed","USD","4,466.50","-196.83","4,269.67","paypal@partner2.com","paypal@my-company.com","TID9","Confirmed","","RTID3","34","RID3","8,289.77","","Payment to My Company for invoice 34",""
+"22/07/2016","12:15:13","PDT","PARTNER2","Website Payment","Completed","USD","6,245.50","-275.10","5,970.40","paypal@partner2.com","paypal@my-company.com","TID10","Confirmed","","RTID4","35","RID4","14,260.17","","Payment to My Company for invoice 35",""
+"25/07/2016","01:47:56","PDT","","General Withdrawal","Pending","EUR","-12,431.37","0.00","-12,431.37","paypal@my-company.com","","TID11","","","","","","-12,388.03","","",""
+"25/07/2016","01:47:56","PDT","","General Currency Conversion","Completed","USD","-14,000.00","0.00","-14,000.00","paypal@my-company.com","","TID12","","","TID11","","","260.17","","",""
+"25/07/2016","01:47:56","PDT","","General Currency Conversion","Completed","EUR","12,431.37","0.00","12,431.37","","paypal@my-company.com","TID13","","","TID11","","","43.34","","",""
+"26/07/2016","04:31:12","PDT","PARTNER4","Website Payment","Completed","USD","-195.00","0.00","-195.00","paypal@my-company.com","paypal@partner4.com","TID14","Non-Confirmed","0.00","","PARTNER4-INV1","","65.17","","Shopping Cart",""
+"01/08/2016","15:11:56","PDT","PARTNER5","Website Payment","Completed","USD","2,616.25","-115.42","2,500.83","paypal@partner5.com","paypal@my-company.com","TID15","Confirmed","","RTID5","36","","2,566.00","","Payment to My Company for invoice 36",""
+"15/08/2016","14:34:48","PDT","PARTNER2","Website Payment","Completed","USD","2,249.00","-99.26","2,149.74","paypal@partner2.com","paypal@my-company.com","TID16","Confirmed","","RTID6","37","RID5","4,715.74","","Payment to My Company for invoice 37",""
+"24/08/2016","21:17:40","PDT","PARTNER5","Website Payment","Completed","USD","2,683.75","-118.39","2,565.36","paypal@partner5.com","paypal@my-company.com","TID17","Confirmed","","RTID7","38","","7,281.10","","Payment to My Company for invoice 38",""
+"28/08/2016","23:18:09","PDT","","General Withdrawal","Pending","EUR","-6,248.60","0.00","-6,248.60","paypal@my-company.com","","TID18","","","","","","-6,205.26","","",""
+"28/08/2016","23:18:09","PDT","","General Currency Conversion","Completed","USD","-7,200.00","0.00","-7,200.00","paypal@my-company.com","","TID19","","","TID18","","","81.10","","",""
+"28/08/2016","23:18:09","PDT","","General Currency Conversion","Completed","EUR","6,248.60","0.00","6,248.60","","paypal@my-company.com","TID20","","","TID18","","","43.34","","",""
+"29/08/2016","09:37:37","PDT","PARTNER2","Website Payment","Completed","USD","1,428.75","-63.17","1,365.58","paypal@partner2.com","paypal@my-company.com","TID21","Confirmed","","RTID8","40","RID6","1,446.68","","Payment to My Company for invoice 40",""
+"29/08/2016","11:44:29","PDT","","General Withdrawal","Pending","EUR","-1,219.77","0.00","-1,219.77","paypal@my-company.com","","TID22","","","","","","-1,176.43","","",""
+"29/08/2016","11:44:29","PDT","","General Currency Conversion","Completed","USD","-1,400.00","0.00","-1,400.00","paypal@my-company.com","","TID23","","","TID22","","","46.68","","",""
+"29/08/2016","11:44:29","PDT","","General Currency Conversion","Completed","EUR","1,219.77","0.00","1,219.77","","paypal@my-company.com","TID24","","","TID22","","","43.34","","",""
+"06/09/2016","20:33:20","PDT","PARTNER5","Website Payment","Completed","USD","4,439.05","-195.62","4,243.43","paypal@partner5.com","paypal@my-company.com","TID25","Confirmed","","RTID9","41","","4,290.11","","Payment to My Company for invoice 41",""
+"06/09/2016","22:02:21","PDT","","General Withdrawal","Pending","EUR","-3,640.49","0.00","-3,640.49","paypal@my-company.com","","TID26","","","","","","-3,597.15","","",""
+"06/09/2016","22:02:21","PDT","","General Currency Conversion","Completed","USD","-4,200.00","0.00","-4,200.00","paypal@my-company.com","","TID27","","","TID26","","","90.11","","",""
+"06/09/2016","22:02:21","PDT","","General Currency Conversion","Completed","EUR","3,640.49","0.00","3,640.49","","paypal@my-company.com","TID28","","","TID26","","","43.34","","",""
+"13/09/2016","20:01:45","PDT","PARTNER5","Website Payment","Completed","USD","2,967.50","-130.87","2,836.63","paypal@partner5.com","paypal@my-company.com","TID29","Confirmed","","RTID10","43","","2,926.74","","Payment to My Company for invoice 43",""
+"14/09/2016","06:58:24","PDT","","General Withdrawal","Pending","EUR","-2,516.43","0.00","-2,516.43","paypal@my-company.com","","TID30","","","","","","-2,473.09","","",""
+"14/09/2016","06:58:24","PDT","","General Currency Conversion","Completed","USD","-2,900.00","0.00","-2,900.00","paypal@my-company.com","","TID31","","","TID30","","","26.74","","",""
+"14/09/2016","06:58:24","PDT","","General Currency Conversion","Completed","EUR","2,516.43","0.00","2,516.43","","paypal@my-company.com","TID32","","","TID30","","","43.34","","",""
+"14/09/2016","16:53:38","PDT","PARTNER6","Website Payment","Completed","USD","603.75","-26.87","576.88","paypal@partner6.com","paypal@my-company.com","TID33","Confirmed","","RTID11","45","","603.62","","Payment to My Company for invoice 45",""
+"15/09/2016","13:11:39","PDT","PARTNER2","Website Payment","Completed","USD","779.00","-34.58","744.42","paypal@partner2.com","paypal@my-company.com","TID34","Confirmed","","RTID12","44","RID7","1,348.04","","Payment to My Company for invoice 44",""
+"24/09/2016","08:40:33","PDT","PARTNER6","Website Payment","Completed","USD","983.50","-43.57","939.93","paypal@partner6.com","paypal@my-company.com","TID35","Confirmed","","RTID13","50","","2,287.97","","Payment to My Company for invoice 50",""
+"25/09/2016","13:34:51","PDT","PARTNER7","Website Payment","Completed","USD","3,920.00","-172.78","3,747.22","paypal@partner7.com","paypal@my-company.com","TID36","Non-Confirmed","","RTID14","47","","6,035.19","","Payment to My Company for invoice 47",""
+"25/09/2016","13:34:51","PDT","","Payment Hold","Completed","USD","-3,747.22","0.00","-3,747.22","paypal@my-company.com","","TID37","","","TID36","47","","2,287.97","","",""
+"26/09/2016","00:57:57","PDT","","General Withdrawal","Pending","EUR","-1,952.53","0.00","-1,952.53","paypal@my-company.com","","TID38","","","","","","-1,909.19","","",""
+"26/09/2016","00:57:57","PDT","","General Currency Conversion","Completed","USD","-2,250.00","0.00","-2,250.00","paypal@my-company.com","","TID39","","","TID38","","","37.97","","",""
+"26/09/2016","00:57:57","PDT","","General Currency Conversion","Completed","EUR","1,952.53","0.00","1,952.53","","paypal@my-company.com","TID40","","","TID38","","","43.34","","",""
+"26/09/2016","21:36:04","PDT","PARTNER5","Website Payment","Completed","USD","3,623.75","-159.75","3,464.00","paypal@partner5.com","paypal@my-company.com","TID41","Confirmed","","RTID15","48","","3,501.97","","Payment to My Company for invoice 48",""
+"26/09/2016","22:11:37","PDT","","General Withdrawal","Pending","EUR","-3,026.35","0.00","-3,026.35","paypal@my-company.com","","TID42","","","","","","-2,983.01","","",""
+"26/09/2016","22:11:37","PDT","","General Currency Conversion","Completed","USD","-3,500.00","0.00","-3,500.00","paypal@my-company.com","","TID43","","","TID42","","","1.97","","",""
+"26/09/2016","22:11:37","PDT","","General Currency Conversion","Completed","EUR","3,026.35","0.00","3,026.35","","paypal@my-company.com","TID44","","","TID42","","","43.34","","",""
+"27/09/2016","15:58:17","PDT","PARTNER2","Website Payment","Completed","USD","1,985.25","-87.65","1,897.60","paypal@partner2.com","paypal@my-company.com","TID45","Confirmed","","RTID16","49","RID8","1,899.57","","Payment to My Company for invoice 49",""
+"28/09/2016","13:38:43","PDT","","Payment Release","Completed","USD","3,747.22","0.00","3,747.22","","paypal@my-company.com","TID46","","","TID36","47","","5,646.79","","",""
+"28/09/2016","15:39:16","PDT","","General Withdrawal","Pending","EUR","-4,904.75","0.00","-4,904.75","paypal@my-company.com","","TID47","","","","","","-4,861.41","","",""
+"28/09/2016","15:39:16","PDT","","General Currency Conversion","Completed","USD","-5,640.00","0.00","-5,640.00","paypal@my-company.com","","TID48","","","TID47","","","6.79","","",""
+"28/09/2016","15:39:16","PDT","","General Currency Conversion","Completed","EUR","4,904.75","0.00","4,904.75","","paypal@my-company.com","TID49","","","TID47","","","43.34","","",""
+"11/10/2016","10:21:06","PDT","PARTNER2","Website Payment","Completed","USD","1,406.75","-52.35","1,354.40","paypal@partner2.com","paypal@my-company.com","TID50","Confirmed","","RTID17","53","RID9","1,361.19","","Payment to My Company for invoice 53",""
+"17/10/2016","08:39:03","PDT","PARTNER8","Website Payment","Completed","USD","1,505.00","-55.99","1,449.01","paypal@partner8.com","paypal@my-company.com","TID51","Non-Confirmed","","RTID18","54","RID10","2,810.20","","Payment to My Company for invoice 54",""
+"18/10/2016","21:40:10","PDT","PARTNER5","Website Payment","Completed","USD","5,973.40","-221.32","5,752.08","paypal@partner5.com","paypal@my-company.com","TID52","Confirmed","","RTID19","52","","8,562.28","","Payment to My Company for invoice 52",""
+"24/10/2016","05:52:21","PDT","PARTNER6","Website Payment","Completed","USD","2,129.75","-79.10","2,050.65","paypal@partner6.com","paypal@my-company.com","TID53","Confirmed","","RTID20","55","","10,612.93","","Payment to My Company for invoice 55",""
+"24/10/2016","06:32:13","PDT","","General Withdrawal","Pending","EUR","-9,484.13","0.00","-9,484.13","paypal@my-company.com","","TID54","","","","","","-9,440.79","","",""
+"24/10/2016","06:32:13","PDT","","General Currency Conversion","Completed","USD","-10,600.00","0.00","-10,600.00","paypal@my-company.com","","TID55","","","TID54","","","12.93","","",""
+"24/10/2016","06:32:13","PDT","","General Currency Conversion","Completed","EUR","9,484.13","0.00","9,484.13","","paypal@my-company.com","TID56","","","TID54","","","43.34","","",""
+"25/10/2016","06:51:49","PDT","PARTNER7","Website Payment","Completed","USD","4,725.00","-175.13","4,549.87","paypal@partner7.com","paypal@my-company.com","TID57","Non-Confirmed","","RTID21","59","","4,562.80","","Payment to My Company for invoice 59",""
+"27/10/2016","03:00:00","PDT","","General Withdrawal","Pending","EUR","-4,061.92","0.00","-4,061.92","paypal@my-company.com","","TID58","","","","","","-4,018.58","","",""
+"27/10/2016","03:00:00","PDT","","General Currency Conversion","Completed","USD","-4,550.00","0.00","-4,550.00","paypal@my-company.com","","TID59","","","TID58","","","12.80","","",""
+"27/10/2016","03:00:00","PDT","","General Currency Conversion","Completed","EUR","4,061.92","0.00","4,061.92","","paypal@my-company.com","TID60","","","TID58","","","43.34","","",""
+"28/10/2016","09:28:14","PDT","PARTNER2","Website Payment","Completed","USD","3,140.75","-116.51","3,024.24","paypal@partner2.com","paypal@my-company.com","TID61","Confirmed","","RTID22","58","RID11","3,037.04","","Payment to My Company for invoice 58",""
+"29/10/2016","04:07:58","PDT","","General Withdrawal","Pending","EUR","-2,668.56","0.00","-2,668.56","paypal@my-company.com","","TID62","","","","","","-2,625.22","","",""
+"29/10/2016","04:07:58","PDT","","General Currency Conversion","Completed","USD","-3,000.00","0.00","-3,000.00","paypal@my-company.com","","TID63","","","TID62","","","37.04","","",""
+"29/10/2016","04:07:58","PDT","","General Currency Conversion","Completed","EUR","2,668.56","0.00","2,668.56","","paypal@my-company.com","TID64","","","TID62","","","43.34","","",""
+"31/10/2016","10:57:29","PDT","PARTNER9","Website Payment","Completed","USD","2,616.25","-97.10","2,519.15","paypal@partner9.com","paypal@my-company.com","TID65","Confirmed","","RTID23","62","","2,556.19","","Payment to My Company for invoice 62",""
+"31/10/2016","11:05:15","PDT","","General Withdrawal","Pending","EUR","-2,267.68","0.00","-2,267.68","paypal@my-company.com","","TID66","","","","","","-2,224.34","","",""
+"31/10/2016","11:05:15","PDT","","General Currency Conversion","Completed","USD","-2,550.00","0.00","-2,550.00","paypal@my-company.com","","TID67","","","TID66","","","6.19","","",""
+"31/10/2016","11:05:15","PDT","","General Currency Conversion","Completed","EUR","2,267.68","0.00","2,267.68","","paypal@my-company.com","TID68","","","TID66","","","43.34","","",""
+"01/11/2016","09:41:29","PDT","PARTNER6","Website Payment","Completed","USD","1,246.00","-46.40","1,199.60","paypal@partner6.com","paypal@my-company.com","TID69","Confirmed","","RTID24","61","","1,205.79","","Payment to My Company for invoice 61",""
+"01/11/2016","09:50:01","PDT","","General Withdrawal","Pending","EUR","-1,063.52","0.00","-1,063.52","paypal@my-company.com","","TID70","","","","","","-1,020.18","","",""
+"01/11/2016","09:50:01","PDT","","General Currency Conversion","Completed","USD","-1,200.00","0.00","-1,200.00","paypal@my-company.com","","TID71","","","TID70","","","5.79","","",""
+"01/11/2016","09:50:01","PDT","","General Currency Conversion","Completed","EUR","1,063.52","0.00","1,063.52","","paypal@my-company.com","TID72","","","TID70","","","43.34","","",""
+"01/11/2016","15:40:16","PDT","PARTNER5","Website Payment","Completed","USD","4,586.10","-169.99","4,416.11","paypal@partner5.com","paypal@my-company.com","TID73","Confirmed","","RTID25","57","","4,421.90","","Payment to My Company for invoice 57",""
+"01/11/2016","18:39:27","PDT","","General Withdrawal","Pending","EUR","-3,897.58","0.00","-3,897.58","paypal@my-company.com","","TID74","","","","","","-3,854.24","","",""
+"01/11/2016","18:39:27","PDT","","General Currency Conversion","Completed","USD","-4,420.00","0.00","-4,420.00","paypal@my-company.com","","TID75","","","TID74","","","1.90","","",""
+"01/11/2016","18:39:27","PDT","","General Currency Conversion","Completed","EUR","3,897.58","0.00","3,897.58","","paypal@my-company.com","TID76","","","TID74","","","43.34","","",""
diff --git a/account_statement_import_paypal/tests/fixtures/empty_activity.csv b/account_statement_import_paypal/tests/fixtures/empty_activity.csv
new file mode 100644
index 00000000..1729ed77
--- /dev/null
+++ b/account_statement_import_paypal/tests/fixtures/empty_activity.csv
@@ -0,0 +1 @@
+"Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Address Status","Sales Tax","Reference Txn ID","Invoice Number","Receipt ID","Balance","Contact Phone Number","Subject","Note"
diff --git a/account_statement_import_paypal/tests/fixtures/statement_en.csv b/account_statement_import_paypal/tests/fixtures/statement_en.csv
new file mode 100644
index 00000000..b7407dbb
--- /dev/null
+++ b/account_statement_import_paypal/tests/fixtures/statement_en.csv
@@ -0,0 +1,20 @@
+"Date","Time","Time Zone","Description","Currency","Gross","Fee","Net","Balance","Transaction ID","From Email Address","Name","Bank Name","Bank Account","Shipping and Handling Amount","Sales Tax","Invoice ID","Reference Txn ID"
+"9/4/2018","21:15:11","America/Los_Angeles","General Withdrawal - Bank Account","EUR","-1,058.09","0.00","-1,058.09","-1,057.34","TID1","","","Bank A","6491","0.00","0.00","",""
+"9/4/2018","21:15:11","America/Los_Angeles","General Currency Conversion","EUR","1,058.09","0.00","1,058.09","0.75","TID2","","","","","0.00","0.00","","TID1"
+"9/11/2018","00:01:50","America/Los_Angeles","General Withdrawal - Bank Account","EUR","-3,105.58","0.00","-3,105.58","-3,104.83","TID3","","","Bank B","9169","0.00","0.00","",""
+"9/11/2018","00:01:50","America/Los_Angeles","General Currency Conversion","EUR","3,105.58","0.00","3,105.58","0.75","TID4","","","","","0.00","0.00","","TID3"
+"9/25/2018","04:22:39","America/Los_Angeles","General Withdrawal - Bank Account","EUR","-3,534.51","0.00","-3,534.51","-3,533.76","TID5","","","Bank B","9169","0.00","0.00","",""
+"9/25/2018","04:22:39","America/Los_Angeles","General Currency Conversion","EUR","3,534.51","0.00","3,534.51","0.75","TID6","","","","","0.00","0.00","","TID5"
+"9/27/2018","21:33:27","America/Los_Angeles","General Withdrawal - Bank Account","EUR","-9,648.13","0.00","-9,648.13","-9,647.38","TID7","","","Bank B","9169","0.00","0.00","",""
+"9/27/2018","21:33:27","America/Los_Angeles","General Currency Conversion","EUR","9,648.13","0.00","9,648.13","0.75","TID8","","","","","0.00","0.00","","TID7"
+"9/4/2018","20:44:10","America/Los_Angeles","Express Checkout Payment","USD","1,309.80","-48.76","1,261.04","1,261.93","TID9","paypal@partner1.com","Partner 1","","","0.00","0.00","361",""
+"9/4/2018","21:15:11","America/Los_Angeles","General Currency Conversion","USD","-1,261.00","0.00","-1,261.00","0.93","TID10","","","","","0.00","0.00","","TID1"
+"9/10/2018","17:48:19","America/Los_Angeles","Express Checkout Payment","USD","3,840.60","-142.40","3,698.20","3,699.13","TID11","paypa@partner2.com","Partner 2","","","0.00","0.00","362",""
+"9/11/2018","00:01:50","America/Los_Angeles","General Currency Conversion","USD","-3,699.00","0.00","-3,699.00","0.13","TID12","","","","","0.00","0.00","","TID3"
+"9/24/2018","16:41:01","America/Los_Angeles","Express Checkout Payment","USD","4,447.40","-164.85","4,282.55","4,282.68","TID13","paypa@partner2.com","Partner 2","","","0.00","0.00","363",""
+"9/25/2018","04:22:39","America/Los_Angeles","General Currency Conversion","USD","-4,282.00","0.00","-4,282.00","0.68","TID14","","","","","0.00","0.00","","TID5"
+"9/27/2018","18:15:34","America/Los_Angeles","Express Checkout Payment","USD","5,600.00","-207.50","5,392.50","5,393.18","TID15","paypa@partner3.com","Partner 3","","","0.00","0.00","366",""
+"9/27/2018","18:16:12","CET","Express Checkout Payment","USD","920.70","-34.37","886.33","6,279.51","TID16","paypa@partner3.com","Partner 3","","","0.00","0.00","367",""
+"9/27/2018","18:17:59","America/Los_Angeles","Express Checkout Payment","USD","5,600.00","-207.50","5,392.50","11,672.01","TID17","paypa@partner3.com","Partner 3","","","0.00","0.00","371",""
+"9/27/2018","21:33:27","America/Los_Angeles","General Currency Conversion","USD","-11,672.00","0.00","-11,672.00","0.01","TID18","","","","","0.00","0.00","","TID7"
+"9/30/2018","21:22:33","America/Los_Angeles","Express Checkout Payment","USD","292.30","-11.12","281.18","281.19","TID19","paypal@partner1.com","Partner 1","","","0.00","0.00","380",""
diff --git a/account_statement_import_paypal/tests/paypal_en.csv b/account_statement_import_paypal/tests/paypal_en.csv
deleted file mode 100644
index 234a3273..00000000
--- a/account_statement_import_paypal/tests/paypal_en.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-"Date","Time","Time Zone","Description","Currency","Gross","Fee ","Net","Balance","Transaction ID","From Email Address","Name","Bank Name","Bank Account","Shipping and Handling Amount","Sales Tax","Invoice ID","Reference Txn ID"
-"12/15/2018","20:07:53","CET","Your best supplier","USD","-33.50","-2.3","-31.2","-31.2","53820712527632627","","John Doe","Bank of America","123456789","0","0","INV25","23"
-"12/15/2018","22:07:53","CET","Your payment","USD","1,525.00","0","1,525.00","1,493.80","34731322767782103","","Azure Interior","","","0","0","INV/2019/0003","24"
diff --git a/account_statement_import_paypal/tests/test_account_bank_statement_import_paypal.py b/account_statement_import_paypal/tests/test_account_bank_statement_import_paypal.py
new file mode 100644
index 00000000..8ad24de1
--- /dev/null
+++ b/account_statement_import_paypal/tests/test_account_bank_statement_import_paypal.py
@@ -0,0 +1,132 @@
+# Copyright 2019 Tecnativa - Vicent Cubells
+# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from odoo import fields
+from odoo.exceptions import UserError
+from odoo.tests import common
+
+from base64 import b64encode
+from os import path
+
+
+class TestAccountBankStatementImportPayPal(common.TransactionCase):
+ def setUp(self):
+ super().setUp()
+
+ self.now = fields.Datetime.now()
+ self.currency_eur = self.env.ref('base.EUR')
+ self.currency_usd = self.env.ref('base.USD')
+ self.paypal_statement_map_en = self.env.ref(
+ 'account_bank_statement_import_paypal.paypal_statement_map_en'
+ )
+ self.paypal_activity_map_en = self.env.ref(
+ 'account_bank_statement_import_paypal.paypal_activity_map_en'
+ )
+ self.AccountJournal = self.env['account.journal']
+ self.AccountBankStatement = self.env['account.bank.statement']
+ self.AccountBankStatementImport = self.env[
+ 'account.bank.statement.import'
+ ]
+ self.AccountBankStatementImportPayPalMapping = self.env[
+ 'account.bank.statement.import.paypal.mapping'
+ ]
+ self.AccountBankStatementImportPayPalMappingWizard = self.env[
+ 'account.bank.statement.import.paypal.mapping.wizard'
+ ]
+
+ def _data_file(self, filename):
+ with open(path.join(path.dirname(__file__), filename)) as file:
+ return b64encode(file.read().encode('utf-8'))
+
+ def test_import_statement_en(self):
+ journal = self.AccountJournal.create({
+ 'name': 'PayPal',
+ 'type': 'bank',
+ 'code': 'PP',
+ 'currency_id': self.currency_usd.id,
+ })
+ wizard = self.AccountBankStatementImport.with_context({
+ 'journal_id': journal.id,
+ }).create({
+ 'filename': 'fixtures/statement_en.csv',
+ 'data_file': self._data_file('fixtures/statement_en.csv'),
+ 'paypal_mapping_id': self.paypal_statement_map_en.id,
+ })
+ wizard.with_context({
+ 'journal_id': journal.id,
+ 'account_bank_statement_import_paypal_test': True,
+ }).import_file()
+ statement = self.AccountBankStatement.search([
+ ('journal_id', '=', journal.id),
+ ])
+ self.assertEqual(len(statement), 1)
+ self.assertEqual(len(statement.line_ids), 18)
+
+ def test_import_activity_en(self):
+ journal = self.AccountJournal.create({
+ 'name': 'PayPal',
+ 'type': 'bank',
+ 'code': 'PP',
+ 'currency_id': self.currency_usd.id,
+ })
+ wizard = self.AccountBankStatementImport.with_context({
+ 'journal_id': journal.id,
+ }).create({
+ 'filename': 'fixtures/activity_en.csv',
+ 'data_file': self._data_file('fixtures/activity_en.csv'),
+ 'paypal_mapping_id': self.paypal_activity_map_en.id,
+ })
+ wizard.with_context({
+ 'journal_id': journal.id,
+ 'account_bank_statement_import_paypal_test': True,
+ }).import_file()
+ statement = self.AccountBankStatement.search([
+ ('journal_id', '=', journal.id),
+ ])
+ self.assertEqual(len(statement), 1)
+ self.assertEqual(len(statement.line_ids), 71)
+
+ def test_import_empty_activity(self):
+ journal = self.AccountJournal.create({
+ 'name': 'PayPal',
+ 'type': 'bank',
+ 'code': 'PP',
+ 'currency_id': self.currency_usd.id,
+ })
+ wizard = self.AccountBankStatementImport.with_context({
+ 'journal_id': journal.id,
+ }).create({
+ 'filename': 'fixtures/empty_activity.csv',
+ 'data_file': self._data_file('fixtures/empty_activity.csv'),
+ 'paypal_mapping_id': self.paypal_activity_map_en.id,
+ })
+ with self.assertRaises(UserError):
+ wizard.with_context({
+ 'journal_id': journal.id,
+ 'account_bank_statement_import_paypal_test': True,
+ }).import_file()
+ statement = self.AccountBankStatement.search([
+ ('journal_id', '=', journal.id),
+ ])
+ self.assertEqual(len(statement), 0)
+
+ def test_import_activity_mapping_en(self):
+ wizard = self.AccountBankStatementImportPayPalMappingWizard.create({
+ 'filename': 'fixtures/activity_en.csv',
+ 'data_file': self._data_file('fixtures/activity_en.csv'),
+ })
+ mapping = self.AccountBankStatementImportPayPalMapping.browse(
+ wizard.import_mapping()['res_id']
+ )
+ self.assertTrue(mapping)
+
+ def test_import_statement_mapping_en(self):
+ wizard = self.AccountBankStatementImportPayPalMappingWizard.create({
+ 'filename': 'fixtures/statement_en.csv',
+ 'data_file': self._data_file('fixtures/statement_en.csv'),
+ })
+ mapping = self.AccountBankStatementImportPayPalMapping.browse(
+ wizard.import_mapping()['res_id']
+ )
+ self.assertTrue(mapping)
diff --git a/account_statement_import_paypal/tests/test_paypal_statement_import.py b/account_statement_import_paypal/tests/test_paypal_statement_import.py
deleted file mode 100644
index 632aec92..00000000
--- a/account_statement_import_paypal/tests/test_paypal_statement_import.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright 2019 Tecnativa - Vicent Cubells
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-
-import os
-import base64
-from odoo.tests import common
-
-
-class TestPaypalFile(common.SavepointCase):
- @classmethod
- def setUpClass(cls):
- super(TestPaypalFile, cls).setUpClass()
-
- cls.map = cls.env['account.bank.statement.import.paypal.map'].create({
- 'name': 'Paypal Map Test',
- })
- usd = cls.env.ref('base.USD')
- cls.journal = cls.env['account.journal'].create({
- 'name': 'Paypal Bank',
- 'type': 'bank',
- 'code': 'PYPAL',
- 'currency_id': (
- usd.id if cls.env.user.company_id.currency_id != usd else False
- ),
- })
-
- def _do_import(self, file_name):
- file_name = os.path.join(os.path.dirname(__file__), file_name)
- return open(file_name).read()
-
- def test_import_header(self):
- file = self._do_import('paypal_en.csv')
- file = base64.b64encode(file.encode("utf-8"))
- wizard = self.env['wizard.paypal.map.create'].with_context({
- 'journal_id': self.journal.id,
- 'active_ids': [self.map.id],
- }).create({'data_file': file})
- wizard.create_map_lines()
- self.assertEqual(len(self.map.map_line_ids.ids), 18)
-
- def test_import_paypal_file(self):
- # Current statements before to run the wizard
- old_statements = self.env['account.bank.statement'].search([])
- # This journal is for Paypal statements
- paypal_map = self.env.ref(
- 'account_bank_statement_import_paypal.paypal_map'
- )
- self.journal.paypal_map_id = paypal_map.id
- file = self._do_import('paypal_en.csv')
- file = base64.b64encode(file.encode("utf-8"))
- wizard = self.env['account.bank.statement.import'].with_context({
- 'journal_id': self.journal.id,
- }).create({'data_file': file})
- wizard.import_file()
- staments_now = self.env['account.bank.statement'].search([])
- statement = staments_now - old_statements
- self.assertEqual(len(statement.line_ids), 3)
- self.assertEqual(len(statement.mapped('line_ids').filtered(
- lambda x: x.partner_id)), 1)
- self.assertAlmostEqual(
- sum(statement.mapped('line_ids.amount')), 1489.2
- )
diff --git a/account_statement_import_paypal/wizards/account_bank_statement_import_view.xml b/account_statement_import_paypal/views/account_bank_statement_import.xml
similarity index 51%
rename from account_statement_import_paypal/wizards/account_bank_statement_import_view.xml
rename to account_statement_import_paypal/views/account_bank_statement_import.xml
index ecb73648..6d5d7bf4 100644
--- a/account_statement_import_paypal/wizards/account_bank_statement_import_view.xml
+++ b/account_statement_import_paypal/views/account_bank_statement_import.xml
@@ -1,12 +1,21 @@
+





-
+