diff --git a/account_bank_statement_import_paypal/README.rst b/account_bank_statement_import_paypal/README.rst new file mode 100644 index 00000000..f14ab9df --- /dev/null +++ b/account_bank_statement_import_paypal/README.rst @@ -0,0 +1,107 @@ +============================= +Import Paypal Bank Statements +============================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github + :target: https://github.com/OCA/bank-statement-import/tree/12.0/account_bank_statement_import_paypal + :alt: OCA/bank-statement-import +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/bank-statement-import-12-0/bank-statement-import-12-0-account_bank_statement_import_paypal + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/174/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to import the Paypal CSV files in Odoo as bank +statements. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +* Create or go to a bank journal where you want to import Paypal statement. +* Edit that journal and set a Paypal map in **Paypal Map** section in **Advanced + Settings** tab. + +* Now you can import Paypal statements in that journal. + +Note: if existent Paypal Map does not fit to your file to import, you can +create another map in **Invoicing > Configuration > Accounting > Paypal +Mapping**. + +You can import headers from any Paypal file in **Action > Create Paypal Map +Lines** and set every line with which field of statement have to match. + +Usage +===== + +To use this module, you need to: + +#. Go to Paypal and download your Bank Statement + +.. image:: https://raw.githubusercontent.com/OCA/bank-statement-import/12.0/account_bank_statement_import_paypal/account_bank_statement_import_paypal/static/description/paypal_backoffice.png + :alt: . +.. image:: https://raw.githubusercontent.com/OCA/bank-statement-import/12.0/account_bank_statement_import_paypal/static/description/paypal_backoffice.png + :alt: . + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Alexis de Lattre +* Sebastien BEAU +* Tecnativa (https://www.tecnativa.com) + + * Vicent Cubells + * Victor M.M. Torres + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/bank-statement-import `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_bank_statement_import_paypal/__init__.py b/account_bank_statement_import_paypal/__init__.py new file mode 100644 index 00000000..aee8895e --- /dev/null +++ b/account_bank_statement_import_paypal/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizards diff --git a/account_bank_statement_import_paypal/__manifest__.py b/account_bank_statement_import_paypal/__manifest__.py new file mode 100644 index 00000000..701d6bf8 --- /dev/null +++ b/account_bank_statement_import_paypal/__manifest__.py @@ -0,0 +1,26 @@ +# Copyright 2014-2017 Akretion (http://www.akretion.com). +# @author Alexis de Lattre +# @author Sébastien BEAU +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Import Paypal Bank Statements", + 'summary': 'Import Paypal CSV files as Bank Statements in Odoo', + "version": "12.0.1.0.0", + "category": "Accounting", + "website": "https://github.com/OCA/bank-statement-import", + "author": " Akretion, Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "depends": [ + "account_bank_statement_import", + "sale", + ], + "data": [ + "security/ir.model.access.csv", + "data/paypal_map_data.xml", + "wizards/create_map_lines_from_file_views.xml", + "wizards/account_bank_statement_import_view.xml", + "views/account_journal_views.xml", + "views/paypal_map_views.xml", + ] +} diff --git a/account_bank_statement_import_paypal/data/paypal_map_data.xml b/account_bank_statement_import_paypal/data/paypal_map_data.xml new file mode 100644 index 00000000..0eeef9ba --- /dev/null +++ b/account_bank_statement_import_paypal/data/paypal_map_data.xml @@ -0,0 +1,116 @@ + + + + + Paypal Monthly Statement + comma + dot + + + + Date + 0 + + date + %m/%d/%Y + + + Time + 1 + + time + + + Time Zone + 2 + + + + Description + 3 + + description + + + Currency + 4 + + currency + + + Gross + 5 + + amount + + + Fee + 6 + + commission + + + Net + 7 + + + + Balance + 8 + + balance + + + Transaction ID + 9 + + transaction_id + + + From Email Address + 10 + + email + + + Name + 11 + + partner_name + + + Bank Name + 12 + + bank_name + + + Bank Account + 13 + + bank_account + + + Shipping and Handling Amount + 14 + + + + Sales Tax + 15 + + + + Invoice ID + 16 + + invoice_number + + + Reference Txn ID + 17 + + origin_transaction_id + + + diff --git a/account_bank_statement_import_paypal/i18n/account_bank_statement_import_paypal.pot b/account_bank_statement_import_paypal/i18n/account_bank_statement_import_paypal.pot new file mode 100644 index 00000000..3e24e191 --- /dev/null +++ b/account_bank_statement_import_paypal/i18n/account_bank_statement_import_paypal.pot @@ -0,0 +1,339 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_bank_statement_import_paypal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-01-11 10:43+0000\n" +"PO-Revision-Date: 2019-01-11 10:43+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "All the Paypal map lines will be created automatically." +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Balance" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Bank Account" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Bank Name" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_data_file +msgid "Bank Statement File" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Cancel" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Choose a file to import..." +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Create Lines" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.actions.act_window,name:account_bank_statement_import_paypal.action_create_paypal_map_lines +msgid "Create Paypal Map Lines" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_create_uid +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_create_uid +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_create_uid +msgid "Created by" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_create_date +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_create_date +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_create_date +msgid "Created on" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Currency" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Date" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_date_format +msgid "Date Format" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:90 +#, python-format +msgid "Date format of map file and Paypal date does not match." +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Description" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_display_name +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_display_name +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_display_name +msgid "Display Name" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Download a bank statement from your bank and import it here." +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Fee" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_sequence +msgid "Field number" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_filename +msgid "Filename" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "From Email Address" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Gross" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_name +msgid "Header Name" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:73 +#, python-format +msgid "Headers of file to import and Paypal map lines does not match." +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_id +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_id +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_id +msgid "ID" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model,name:account_bank_statement_import_paypal.model_account_bank_statement_import +msgid "Import Bank Statement" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Import Paypal Map Lines" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Invoice ID" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model,name:account_bank_statement_import_paypal.model_account_journal +msgid "Journal" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map___last_update +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line___last_update +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create___last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_write_uid +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_write_uid +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_write_date +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_write_date +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_map_parent_id +msgid "Map Parent" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_map_line_ids +msgid "Map lines" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.statement_import_map_tax_form +msgid "Mapping Lines" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_name +msgid "Name" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Origin Transaction ID" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:226 +#, python-format +msgid "PAYPAL-COSTS" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:191 +#, python-format +msgid "PayPal Import %s > %s" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_journal_paypal_map_id +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.statement_import_map_tax_form +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.statement_import_map_tax_tree +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.view_account_journal_form_n43 +msgid "Paypal Map" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.actions.act_window,name:account_bank_statement_import_paypal.action_statement_import_paypal_mappging +#: model:ir.ui.menu,name:account_bank_statement_import_paypal.menu_statement_import_paypal_mapping +msgid "Paypal Mapping" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:225 +#, python-format +msgid "Paypal commissions" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_id_4185 +msgid "Paypal map" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.statement_import_map_tax_line_form +msgid "Paypal mapping line" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.statement_import_map_tax_line_tree +msgid "Paypal mapping lines" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.account_bank_statement_import_view +msgid "Paypal with Template:" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Select a Paypal bank statement file to create all the map lines from headers file." +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_field_to_assign +msgid "Statement Field to Assign" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Time" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Transaction ID" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:100 +#, python-format +msgid "Value '%s' for the field '%s' on line %d, cannot be converted to float" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:137 +#, python-format +msgid "You must run this wizard from the journal" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model,name:account_bank_statement_import_paypal.model_account_bank_statement_import_paypal_map +msgid "account.bank.statement.import.paypal.map" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model,name:account_bank_statement_import_paypal.model_account_bank_statement_import_paypal_map_line +msgid "account.bank.statement.import.paypal.map.line" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:122 +#, python-format +msgid "currency %s on line %d cannot be found in odoo" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,date_format:0 +msgid "i.e. 12/15/2019" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,date_format:0 +msgid "i.e. 15/12/2019" +msgstr "" + +#. module: account_bank_statement_import_paypal +#: model:ir.model,name:account_bank_statement_import_paypal.model_wizard_paypal_map_create +msgid "wizard.paypal.map.create" +msgstr "" + diff --git a/account_bank_statement_import_paypal/i18n/es.po b/account_bank_statement_import_paypal/i18n/es.po new file mode 100644 index 00000000..d2c58f02 --- /dev/null +++ b/account_bank_statement_import_paypal/i18n/es.po @@ -0,0 +1,348 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_bank_statement_import_paypal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-01-11 10:43+0000\n" +"PO-Revision-Date: 2019-01-11 11:44+0100\n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"X-Generator: Poedit 2.1.1\n" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "All the Paypal map lines will be created automatically." +msgstr "Todas las lineas de la plantilla se crearán automáticamente." + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Balance" +msgstr "Saldo" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Bank Account" +msgstr "Cuenta bancaria" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Bank Name" +msgstr "Nombre del banco" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_data_file +msgid "Bank Statement File" +msgstr "Archivo de extracto bancario" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Cancel" +msgstr "Cancelar" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Choose a file to import..." +msgstr "Escoja un archivo a importar..." + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Create Lines" +msgstr "Crear líneas" + +#. module: account_bank_statement_import_paypal +#: model:ir.actions.act_window,name:account_bank_statement_import_paypal.action_create_paypal_map_lines +msgid "Create Paypal Map Lines" +msgstr "Crear las líneas de la plantilla de Paypal" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_create_uid +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_create_uid +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_create_uid +msgid "Created by" +msgstr "Creado el" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_create_date +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_create_date +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_create_date +msgid "Created on" +msgstr "Creado por" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Currency" +msgstr "Moneda" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Date" +msgstr "Fecha" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_date_format +msgid "Date Format" +msgstr "Formato de fecha" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:90 +#, python-format +msgid "Date format of map file and Paypal date does not match." +msgstr "" +"El format de fecha del archivo de plantilla y la fecha de Paypal no " +"coinciden." + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Description" +msgstr "Descripción" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_display_name +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_display_name +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Download a bank statement from your bank and import it here." +msgstr "Descargue un extracto bancario desde su banco e impórtelo aquí." + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Fee" +msgstr "Tarifa" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_sequence +msgid "Field number" +msgstr "Nº de campo" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_filename +msgid "Filename" +msgstr "Nombre de archivo" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "From Email Address" +msgstr "Correo electrónico del remitente" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Gross" +msgstr "Bruto" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_name +msgid "Header Name" +msgstr "Nombre de la cabecera" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:73 +#, python-format +msgid "Headers of file to import and Paypal map lines does not match." +msgstr "" +"La cabecera del archivo a importar y las lineas de la plantilla de Paypal no " +"coinciden." + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_id +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_id +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_id +msgid "ID" +msgstr "ID" + +#. module: account_bank_statement_import_paypal +#: model:ir.model,name:account_bank_statement_import_paypal.model_account_bank_statement_import +msgid "Import Bank Statement" +msgstr "Importar Extracto Bancario" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "Import Paypal Map Lines" +msgstr "Importar las lineas de la plantilla de Paypal" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Invoice ID" +msgstr "Número de factura" + +#. module: account_bank_statement_import_paypal +#: model:ir.model,name:account_bank_statement_import_paypal.model_account_journal +msgid "Journal" +msgstr "Diario" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map___last_update +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line___last_update +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create___last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_write_uid +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_write_uid +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_write_date +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_write_date +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_wizard_paypal_map_create_write_date +msgid "Last Updated on" +msgstr "Última actualización en" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_map_parent_id +msgid "Map Parent" +msgstr "Plantilla padre" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_map_line_ids +msgid "Map lines" +msgstr "Líneas de la plantilla" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.statement_import_map_tax_form +msgid "Mapping Lines" +msgstr "Líneas de la plantilla" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_name +msgid "Name" +msgstr "Nombre" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Origin Transaction ID" +msgstr "Id. de transacción" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:226 +#, python-format +msgid "PAYPAL-COSTS" +msgstr "COSTES-PAYPAL" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:191 +#, python-format +msgid "PayPal Import %s > %s" +msgstr "Importación de Paypal %s > %s" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_journal_paypal_map_id +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.statement_import_map_tax_form +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.statement_import_map_tax_tree +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.view_account_journal_form_n43 +msgid "Paypal Map" +msgstr "Plantilla de Paypal" + +#. module: account_bank_statement_import_paypal +#: model:ir.actions.act_window,name:account_bank_statement_import_paypal.action_statement_import_paypal_mappging +#: model:ir.ui.menu,name:account_bank_statement_import_paypal.menu_statement_import_paypal_mapping +msgid "Paypal Mapping" +msgstr "Plantilla de Paypal" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:225 +#, python-format +msgid "Paypal commissions" +msgstr "Tarifa de Paypal" + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_id_4185 +msgid "Paypal map" +msgstr "Plantilla de Paypal" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.statement_import_map_tax_line_form +msgid "Paypal mapping line" +msgstr "Línea de plantilla de Paypal" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.statement_import_map_tax_line_tree +msgid "Paypal mapping lines" +msgstr "Líneas de plantilla de Paypal" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.account_bank_statement_import_view +msgid "Paypal with Template:" +msgstr "Paypal con la plantilla:" + +#. module: account_bank_statement_import_paypal +#: model:ir.ui.view,arch_db:account_bank_statement_import_paypal.create_paypal_map_lines_view +msgid "" +"Select a Paypal bank statement file to create all the map lines from headers " +"file." +msgstr "" +"Seleccione un archivo de extracto bancario de Paypal para crear todas las " +"lineas de la plantilla a partir de la cabecera del archivo." + +#. module: account_bank_statement_import_paypal +#: model:ir.model.fields,field_description:account_bank_statement_import_paypal.field_account_bank_statement_import_paypal_map_line_field_to_assign +msgid "Statement Field to Assign" +msgstr "Campo del extracto a asignar" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Time" +msgstr "Hora" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,field_to_assign:0 +msgid "Transaction ID" +msgstr "Id. de transacción" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:100 +#, python-format +msgid "Value '%s' for the field '%s' on line %d, cannot be converted to float" +msgstr "" +"El valor '%s' del campo '%s' en la línea %d, no se puede convertir a float" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:137 +#, python-format +msgid "You must run this wizard from the journal" +msgstr "Debe ejecutar este asistente des del diario" + +#. module: account_bank_statement_import_paypal +#: model:ir.model,name:account_bank_statement_import_paypal.model_account_bank_statement_import_paypal_map +msgid "account.bank.statement.import.paypal.map" +msgstr "account.bank.statement.import.paypal.map" + +#. module: account_bank_statement_import_paypal +#: model:ir.model,name:account_bank_statement_import_paypal.model_account_bank_statement_import_paypal_map_line +msgid "account.bank.statement.import.paypal.map.line" +msgstr "account.bank.statement.import.paypal.map.line" + +#. module: account_bank_statement_import_paypal +#: code:addons/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py:122 +#, python-format +msgid "currency %s on line %d cannot be found in odoo" +msgstr "la monea %s de la línea %d no se puede encontrar en odoo" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,date_format:0 +msgid "i.e. 12/15/2019" +msgstr "p.e. 12/15/2019" + +#. module: account_bank_statement_import_paypal +#: selection:account.bank.statement.import.paypal.map.line,date_format:0 +msgid "i.e. 15/12/2019" +msgstr "p.e. 15/12/2019" + +#. module: account_bank_statement_import_paypal +#: model:ir.model,name:account_bank_statement_import_paypal.model_wizard_paypal_map_create +msgid "wizard.paypal.map.create" +msgstr "wizard.paypal.map.create" diff --git a/account_bank_statement_import_paypal/models/__init__.py b/account_bank_statement_import_paypal/models/__init__.py new file mode 100644 index 00000000..4257b3bc --- /dev/null +++ b/account_bank_statement_import_paypal/models/__init__.py @@ -0,0 +1,2 @@ +from . import account_bank_statement_import_paypal_map +from . import account_journal diff --git a/account_bank_statement_import_paypal/models/account_bank_statement_import_paypal_map.py b/account_bank_statement_import_paypal/models/account_bank_statement_import_paypal_map.py new file mode 100644 index 00000000..06c82ef9 --- /dev/null +++ b/account_bank_statement_import_paypal/models/account_bank_statement_import_paypal_map.py @@ -0,0 +1,110 @@ +# Copyright 2019 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models, api + + +class AccountBankStatementImportPaypalMap(models.Model): + _name = 'account.bank.statement.import.paypal.map' + _description = 'Account Bank Statement Import Paypal Map' + + name = fields.Char( + required=True, + ) + map_line_ids = fields.One2many( + comodel_name='account.bank.statement.import.paypal.map.line', + inverse_name='map_parent_id', + string="Map lines", + required=True, + copy=True, + ) + float_thousands_sep = fields.Selection( + [('dot', 'dot (.)'), + ('comma', 'comma (,)'), + ('none', 'none'), + ], + string='Thousands separator', + # forward compatibility: this was the value assumed + # before the field was added. + default='dot', + required=True + ) + float_decimal_sep = fields.Selection( + [('dot', 'dot (.)'), + ('comma', 'comma (,)'), + ('none', 'none'), + ], + string='Decimals separator', + # forward compatibility: this was the value assumed + # before the field was added. + default='comma', + required=True + ) + + @api.onchange('float_thousands_sep') + def onchange_thousands_separator(self): + if 'dot' == self.float_thousands_sep == self.float_decimal_sep: + self.float_decimal_sep = 'comma' + elif 'comma' == self.float_thousands_sep == self.float_decimal_sep: + self.float_decimal_sep = 'dot' + + @api.onchange('float_decimal_sep') + def onchange_decimal_separator(self): + if 'dot' == self.float_thousands_sep == self.float_decimal_sep: + self.float_thousands_sep = 'comma' + elif 'comma' == self.float_thousands_sep == self.float_decimal_sep: + self.float_thousands_sep = 'dot' + + def _get_separators(self): + separators = {'dot': '.', + 'comma': ',', + 'none': '', + } + return (separators[self.float_thousands_sep], + separators[self.float_decimal_sep]) + + +class AccountBankStatementImportPaypalMapLine(models.Model): + _name = 'account.bank.statement.import.paypal.map.line' + _description = 'Account Bank Statement Import Paypal Map Line' + _order = "sequence asc, id asc" + + sequence = fields.Integer( + string="Field number", + required=True, + ) + name = fields.Char( + string="Header Name", + required=True, + ) + map_parent_id = fields.Many2one( + comodel_name='account.bank.statement.import.paypal.map', + required=True, + ondelete='cascade', + ) + field_to_assign = fields.Selection( + selection=[ + ('date', 'Date'), + ('time', 'Time'), + ('description', 'Description'), + ('currency', 'Currency'), + ('amount', 'Gross'), + ('commission', 'Fee'), + ('balance', 'Balance'), + ('transaction_id', 'Transaction ID'), + ('email', 'From Email Address'), + ('partner_name', 'Name'), + ('bank_name', 'Bank Name'), + ('bank_account', 'Bank Account'), + ('invoice_number', 'Invoice ID'), + ('origin_transaction_id', 'Origin Transaction ID'), + ], + string="Statement Field to Assign", + ) + date_format = fields.Selection( + selection=[ + ('%d/%m/%Y', 'i.e. 15/12/2019'), + ('%m/%d/%Y', 'i.e. 12/15/2019'), + ], + string="Date Format", + ) diff --git a/account_bank_statement_import_paypal/models/account_journal.py b/account_bank_statement_import_paypal/models/account_journal.py new file mode 100644 index 00000000..5123a3c6 --- /dev/null +++ b/account_bank_statement_import_paypal/models/account_journal.py @@ -0,0 +1,13 @@ +# Copyright 2019 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AccountJournal(models.Model): + _inherit = "account.journal" + + paypal_map_id = fields.Many2one( + comodel_name='account.bank.statement.import.paypal.map', + string='Paypal Map', + ) diff --git a/account_bank_statement_import_paypal/readme/CONFIGURE.rst b/account_bank_statement_import_paypal/readme/CONFIGURE.rst new file mode 100644 index 00000000..7693cae5 --- /dev/null +++ b/account_bank_statement_import_paypal/readme/CONFIGURE.rst @@ -0,0 +1,12 @@ +* Create or go to a bank journal where you want to import Paypal statement. +* Edit that journal and set a Paypal map in **Paypal Map** section in **Advanced + Settings** tab. + +* Now you can import Paypal statements in that journal. + +Note: if existent Paypal Map does not fit to your file to import, you can +create another map in **Invoicing > Configuration > Accounting > Paypal +Mapping**. + +You can import headers from any Paypal file in **Action > Create Paypal Map +Lines** and set every line with which field of statement have to match. diff --git a/account_bank_statement_import_paypal/readme/CONTRIBUTORS.rst b/account_bank_statement_import_paypal/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..6e9a18d1 --- /dev/null +++ b/account_bank_statement_import_paypal/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Alexis de Lattre +* Sebastien BEAU +* Tecnativa (https://www.tecnativa.com) + + * Vicent Cubells + * Victor M.M. Torres diff --git a/account_bank_statement_import_paypal/readme/DESCRIPTION.rst b/account_bank_statement_import_paypal/readme/DESCRIPTION.rst new file mode 100644 index 00000000..492b95df --- /dev/null +++ b/account_bank_statement_import_paypal/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows you to import the Paypal CSV files in Odoo as bank +statements. diff --git a/account_bank_statement_import_paypal/readme/USAGE.rst b/account_bank_statement_import_paypal/readme/USAGE.rst new file mode 100644 index 00000000..fdcc4da9 --- /dev/null +++ b/account_bank_statement_import_paypal/readme/USAGE.rst @@ -0,0 +1,8 @@ +To use this module, you need to: + +#. Go to Paypal and download your Bank Statement + +.. image:: account_bank_statement_import_paypal/static/description/paypal_backoffice.png + :alt: . +.. image:: static/description/paypal_backoffice.png + :alt: . diff --git a/account_bank_statement_import_paypal/security/ir.model.access.csv b/account_bank_statement_import_paypal/security/ir.model.access.csv new file mode 100644 index 00000000..db61ffb0 --- /dev/null +++ b/account_bank_statement_import_paypal/security/ir.model.access.csv @@ -0,0 +1,3 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +access_account_bank_statement_import_paypal_map,Paypal map manager,model_account_bank_statement_import_paypal_map,account.group_account_manager,1,1,1,1 +access_account_bank_statement_import_paypal_map_line,Paypal map line manager,model_account_bank_statement_import_paypal_map_line,account.group_account_manager,1,1,1,1 diff --git a/account_bank_statement_import_paypal/static/description/icon.png b/account_bank_statement_import_paypal/static/description/icon.png new file mode 100644 index 00000000..5a237c23 Binary files /dev/null and b/account_bank_statement_import_paypal/static/description/icon.png differ diff --git a/account_bank_statement_import_paypal/static/description/index.html b/account_bank_statement_import_paypal/static/description/index.html new file mode 100644 index 00000000..779071f9 --- /dev/null +++ b/account_bank_statement_import_paypal/static/description/index.html @@ -0,0 +1,451 @@ + + + + + + +Import Paypal Bank Statements + + + +
+

Import Paypal Bank Statements

+ + +

Beta License: AGPL-3 OCA/bank-statement-import Translate me on Weblate Try me on Runbot

+

This module allows you to import the Paypal CSV files in Odoo as bank +statements.

+

Table of contents

+ +
+

Configuration

+
    +
  • Create or go to a bank journal where you want to import Paypal statement.
  • +
  • Edit that journal and set a Paypal map in Paypal Map section in Advanced +Settings tab.
  • +
  • Now you can import Paypal statements in that journal.
  • +
+

Note: if existent Paypal Map does not fit to your file to import, you can +create another map in Invoicing > Configuration > Accounting > Paypal +Mapping.

+

You can import headers from any Paypal file in Action > Create Paypal Map +Lines and set every line with which field of statement have to match.

+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Paypal and download your Bank Statement
  2. +
+. +. +
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/bank-statement-import project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_bank_statement_import_paypal/static/description/paypal_backoffice.png b/account_bank_statement_import_paypal/static/description/paypal_backoffice.png new file mode 100644 index 00000000..a902aee1 Binary files /dev/null and b/account_bank_statement_import_paypal/static/description/paypal_backoffice.png differ diff --git a/account_bank_statement_import_paypal/tests/__init__.py b/account_bank_statement_import_paypal/tests/__init__.py new file mode 100644 index 00000000..81608867 --- /dev/null +++ b/account_bank_statement_import_paypal/tests/__init__.py @@ -0,0 +1 @@ +from . import test_paypal_statement_import diff --git a/account_bank_statement_import_paypal/tests/paypal_en.csv b/account_bank_statement_import_paypal/tests/paypal_en.csv new file mode 100644 index 00000000..1bef2f8a --- /dev/null +++ b/account_bank_statement_import_paypal/tests/paypal_en.csv @@ -0,0 +1,3 @@ +"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","","Agrolait","","","0","0","INV/2019/0003","24" diff --git a/account_bank_statement_import_paypal/tests/test_paypal_statement_import.py b/account_bank_statement_import_paypal/tests/test_paypal_statement_import.py new file mode 100644 index 00000000..8bd106fd --- /dev/null +++ b/account_bank_statement_import_paypal/tests/test_paypal_statement_import.py @@ -0,0 +1,58 @@ +# 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', + }) + cls.journal = cls.env['account.journal'].create({ + 'name': 'Paypal Bank', + 'type': 'bank', + 'code': 'PYPAL', + }) + + 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 and x.account_id)), 1) + self.assertAlmostEqual( + sum(statement.mapped('line_ids.amount')), 1489.2 + ) diff --git a/account_bank_statement_import_paypal/views/account_journal_views.xml b/account_bank_statement_import_paypal/views/account_journal_views.xml new file mode 100644 index 00000000..3e565b7d --- /dev/null +++ b/account_bank_statement_import_paypal/views/account_journal_views.xml @@ -0,0 +1,16 @@ + + + + + account.journal + + + + + + + + + + + diff --git a/account_bank_statement_import_paypal/views/paypal_map_views.xml b/account_bank_statement_import_paypal/views/paypal_map_views.xml new file mode 100644 index 00000000..1fee4a66 --- /dev/null +++ b/account_bank_statement_import_paypal/views/paypal_map_views.xml @@ -0,0 +1,67 @@ + + + + + account.bank.statement.import.paypal.map + + + + + + + + + account.bank.statement.import.paypal.map + +
+ + + + + + + + + +
+ + + account.bank.statement.import.paypal.map.line + + + + + + + + + + + + account.bank.statement.import.paypal.map.line + +
+ + + + + + + +
+
+
+ + + Paypal Mapping + account.bank.statement.import.paypal.map + form + tree,form + + + + +
diff --git a/account_bank_statement_import_paypal/wizards/__init__.py b/account_bank_statement_import_paypal/wizards/__init__.py new file mode 100644 index 00000000..006d24cd --- /dev/null +++ b/account_bank_statement_import_paypal/wizards/__init__.py @@ -0,0 +1,2 @@ +from . import create_map_lines_from_file +from . import account_bank_statement_import_paypal diff --git a/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py b/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py new file mode 100644 index 00000000..ba79b534 --- /dev/null +++ b/account_bank_statement_import_paypal/wizards/account_bank_statement_import_paypal.py @@ -0,0 +1,297 @@ +# Copyright 2014-2017 Akretion (http://www.akretion.com). +# @author Alexis de Lattre +# @author Sébastien BEAU +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging +from datetime import datetime +from odoo import _, api, fields, models +from odoo.exceptions import UserError +import re +from io import StringIO +_logger = logging.getLogger(__name__) + +try: + import csv +except (ImportError, IOError) as err: + _logger.debug(err) + +# Paypal header depend of the country the order are the same but the +# value are translated. You can add you header here + +HEADERS = [ + # French + '"Date","Heure","Fuseau horaire","Description","Devise","Avant commission"' + ',"Commission","Net","Solde","Numéro de transaction","Adresse email de ' + 'l\'expéditeur","Nom","Nom de la banque","Compte bancaire","Montant des ' + 'frais de livraison et de traitement","TVA","Identifiant de facture",' + '"Numéro de la transaction de référence"', + # English + '"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"', + ] + + +class AccountBankStatementImport(models.TransientModel): + _inherit = 'account.bank.statement.import' + + paypal_map_id = fields.Many2one( + comodel_name='account.bank.statement.import.paypal.map', + string='Paypal map', + readonly=True, + ) + + @api.model + def _get_paypal_encoding(self): + return 'utf-8-sig' + + @api.model + def _get_paypal_str_data(self, data_file): + if not isinstance(data_file, str): + data_file = data_file.decode(self._get_paypal_encoding()) + return data_file.strip() + + @api.model + def _paypal_convert_amount(self, amount_str): + if self.paypal_map_id: + thousands, decimal = self.paypal_map_id._get_separators() + else: + thousands, decimal = ',', '.' + valstr = re.sub(r'[^\d%s%s.-]' % (thousands, decimal), '', amount_str) + valstrdot = valstr.replace(thousands, '') + valstrdot = valstrdot.replace(decimal, '.') + return float(valstrdot) + + @api.model + def _check_paypal(self, data_file): + data_file = self._get_paypal_str_data(data_file) + if not self.paypal_map_id: + return False + headers = self.mapped('paypal_map_id.map_line_ids.name') + file_headers = data_file.split('\n', 1)[0] + if any(item not in file_headers for item in headers): + raise UserError( + _("Headers of file to import and Paypal map lines does not " + "match.")) + return True + + def _convert_paypal_line_to_dict(self, idx, line): + rline = dict() + for item in range(len(line)): + paypal_map = self.mapped('paypal_map_id.map_line_ids')[item] + value = line[item] + if not paypal_map.field_to_assign: + continue + if paypal_map.date_format: + try: + value = fields.Date.to_string( + datetime.strptime(value, paypal_map.date_format)) + except Exception: + raise UserError( + _("Date format of map file and Paypal date does " + "not match.")) + rline[paypal_map.field_to_assign] = value + + for field in ['commission', 'amount', 'balance']: + _logger.debug('Trying to convert %s to float' % rline[field]) + try: + rline[field] = self._paypal_convert_amount(rline[field]) + except Exception: + raise UserError( + _("Value '%s' for the field '%s' on line %d, " + "cannot be converted to float") + % (rline[field], field, idx)) + return rline + + def _parse_paypal_file(self, data_file): + data_file = self._get_paypal_str_data(data_file) + f = StringIO(data_file) + f.seek(0) + raw_lines = [] + reader = csv.reader(f) + next(reader) # Drop header + for idx, line in enumerate(reader): + _logger.debug("Line %d: %s" % (idx, line)) + raw_lines.append(self._convert_paypal_line_to_dict(idx, line)) + return raw_lines + + def _prepare_paypal_currency_vals(self, cline): + currencies = self.env['res.currency'].search( + [('name', '=', cline['currency'])]) + if not currencies: + raise UserError( + _('currency %s on line %d cannot be found in odoo') + % (cline['currency'], cline['idx'])) + return { + 'amount_currency': cline['amount'], + 'currency_id': currencies.id, + 'currency': cline['currency'], + 'partner_name': cline['partner_name'], + 'description': cline['description'], + 'email': cline['email'], + 'transaction_id': cline['transaction_id'], + } + + def _get_journal(self): + journal_id = self.env.context.get('journal_id') + if not journal_id: + raise UserError(_('You must run this wizard from the journal')) + return self.env['account.journal'].browse(journal_id) + + def _post_process_statement_line(self, raw_lines): + journal = self._get_journal() + currency = journal.currency_id or journal.company_id.currency_id + currency_change_lines = {} + real_transactions = [] + for line in raw_lines: + if line['currency'] != currency.name: + currency_change_lines[line['transaction_id']] = line + else: + real_transactions.append(line) + + for line in real_transactions: + # Check if the current transaction is linked with a + # transaction of currency change if yes merge the transaction + # as for odoo it's only one line + cline = currency_change_lines.get(line['origin_transaction_id']) + if cline: + # we update the current line with currency information + vals = self._prepare_paypal_currency_vals(cline) + line.update(vals) + return real_transactions + + def _prepare_paypal_statement_line(self, fline): + if fline['bank_name']: + name = '|'.join([ + fline['description'], + fline['bank_name'], + fline['bank_account'] + ]) + else: + name = '|'.join([ + fline['description'], + fline['partner_name'], + fline['email'], + fline['invoice_number'], + ]) + return { + 'date': fline['date'], + 'name': name, + 'ref': fline['transaction_id'], + 'unique_import_id': + fline['transaction_id'] + fline['date'] + fline['time'], + 'amount': fline['amount'], + 'bank_account_id': False, + 'currency_id': fline.get('currency_id'), + 'amount_currency': fline.get('amount_currency'), + } + + def _prepare_paypal_statement(self, lines): + return { + 'name': + _('PayPal Import %s > %s') + % (lines[0]['date'], lines[-1]['date']), + 'date': lines[-1]['date'], + 'balance_start': + lines[0]['balance'] - + lines[0]['amount'] - + lines[0]['commission'], + 'balance_end_real': lines[-1]['balance'], + } + + @api.model + def _parse_file(self, data_file): + """ Import a file in Paypal CSV format """ + paypal = self._check_paypal(data_file) + if not paypal: + return super(AccountBankStatementImport, self)._parse_file( + data_file) + + raw_lines = self._parse_paypal_file(data_file) + final_lines = self._post_process_statement_line(raw_lines) + + vals_bank_statement = self._prepare_paypal_statement(final_lines) + + transactions = [] + commission_total = 0 + for fline in final_lines: + commission_total += fline['commission'] + vals_line = self._prepare_paypal_statement_line(fline) + _logger.debug("vals_line = %s" % vals_line) + transactions.append(vals_line) + + if commission_total: + commission_line = { + 'date': vals_bank_statement['date'], + 'name': _('Paypal commissions'), + 'ref': _('PAYPAL-COSTS'), + 'amount': commission_total, + 'unique_import_id': False, + } + transactions.append(commission_line) + + vals_bank_statement['transactions'] = transactions + return None, None, [vals_bank_statement] + + @api.model + def _get_paypal_partner(self, description, partner_name, + partner_email, invoice_number): + if invoice_number: + # In most case e-commerce case invoice_number + # will contain the sale order number + sale = self.env['sale.order'].search([ + ('name', '=', invoice_number)]) + if sale and len(sale) == 1: + return sale.partner_id.commercial_partner_id + + invoice = self.env['account.invoice'].search([ + ('number', '=', invoice_number)]) + if invoice and len(invoice) == 1: + return invoice.partner_id.commercial_partner_id + + if partner_email: + partner = self.env['res.partner'].search([ + ('email', '=', partner_email), + ('parent_id', '=', False)]) + if partner and len(partner) == 1: + return partner.commercial_partner_id + + if partner_name: + partner = self.env['res.partner'].search([ + ('name', '=ilike', partner_name)]) + if partner and len(partner) == 1: + return partner.commercial_partner_id + return None + + @api.model + def _complete_paypal_statement_line(self, line): + _logger.debug('Process line %s', line['name']) + info = line['name'].split('|') + if len(info) == 4: + partner = self._get_paypal_partner(*info) + if partner: + return { + 'partner_id': partner.id, + 'account_id': partner.property_account_receivable_id.id, + } + return None + + @api.model + def _complete_stmts_vals(self, stmts_vals, journal_id, account_number): + """ Match the partner from paypal information """ + stmts_vals = super(AccountBankStatementImport, self). \ + _complete_stmts_vals(stmts_vals, journal_id, account_number) + for line in stmts_vals[0]['transactions']: + vals = self._complete_paypal_statement_line(line) + if vals: + line.update(vals) + return stmts_vals + + @api.model + def default_get(self, fields): + res = super(AccountBankStatementImport, self).default_get(fields) + journal = self._get_journal() + res['paypal_map_id'] = journal.paypal_map_id.id + return res diff --git a/account_bank_statement_import_paypal/wizards/account_bank_statement_import_view.xml b/account_bank_statement_import_paypal/wizards/account_bank_statement_import_view.xml new file mode 100644 index 00000000..ecb73648 --- /dev/null +++ b/account_bank_statement_import_paypal/wizards/account_bank_statement_import_view.xml @@ -0,0 +1,14 @@ + + + + + account.bank.statement.import + + + +
  • Paypal with Template:
  • +
    +
    +
    + +
    diff --git a/account_bank_statement_import_paypal/wizards/create_map_lines_from_file.py b/account_bank_statement_import_paypal/wizards/create_map_lines_from_file.py new file mode 100644 index 00000000..a9ca019a --- /dev/null +++ b/account_bank_statement_import_paypal/wizards/create_map_lines_from_file.py @@ -0,0 +1,39 @@ +# Copyright 2019 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import csv +import base64 +from odoo import api, fields, models +from io import StringIO + + +class WizardPaypalMapCreate(models.TransientModel): + _name = 'wizard.paypal.map.create' + _description = 'Wizard Paypal Map Create' + + data_file = fields.Binary( + string='Bank Statement File', + required=True, + ) + filename = fields.Char() + + @api.multi + def create_map_lines(self): + statement_obj = self.env['account.bank.statement.import.paypal.map'] + data_file = base64.b64decode(self.data_file) + if not isinstance(data_file, str): + data_file = data_file.decode('utf-8-sig').strip() + file = StringIO(data_file) + file.seek(0) + reader = csv.reader(file) + headers = [] + for row in reader: + headers = row + break + lines = [] + for idx, title in enumerate(headers): + lines.append((0, 0, {'sequence': idx, 'name': title})) + if lines: + for statement in statement_obj.browse( + self.env.context.get('active_ids')): + statement.map_line_ids = lines diff --git a/account_bank_statement_import_paypal/wizards/create_map_lines_from_file_views.xml b/account_bank_statement_import_paypal/wizards/create_map_lines_from_file_views.xml new file mode 100644 index 00000000..c61136d5 --- /dev/null +++ b/account_bank_statement_import_paypal/wizards/create_map_lines_from_file_views.xml @@ -0,0 +1,29 @@ + + + + + Create Paypal Map Lines + wizard.paypal.map.create + +
    +

    Select a Paypal bank statement file to create all the map lines from headers file.

    +

    Download a bank statement from your bank and import it here.

    +

    All the Paypal map lines will be created automatically.

    + + +
    +
    + +
    +
    + + +