[MIG] account_bank_statement_import_paypal: Migration to v13.0

This commit is contained in:
Carlos Roca
2020-07-03 09:46:22 +02:00
committed by Pedro M. Baeza
parent 6612a81680
commit 65873b41ce
15 changed files with 158 additions and 243 deletions

View File

@@ -14,13 +14,13 @@ PayPal CSV Format Bank Statements Import
: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
:target: https://github.com/OCA/bank-statement-import/tree/13.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
:target: https://translation.odoo-community.org/projects/bank-statement-import-13-0/bank-statement-import-13-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
:target: https://runbot.odoo-community.org/runbot/174/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -46,8 +46,8 @@ Usage
To import statements from PayPal via Statement report:
#. Go to `PayPal <https://paypal.com/>`__
#. Open *Reports > Statements* and select *Monthly* or *Custom*
#. Go to `PayPal <https://business.paypal.com/merchantdata/reportHome/>`__
#. Open *Statements* and select *Monthly* or *Custom*
#. Select date range of interest and click *Request* under *CSV* column
#. Wait for statement report to be generated
#. Download it and save to a file
@@ -55,8 +55,8 @@ To import statements from PayPal via Statement report:
To import statements from PayPal via Activity report:
#. Go to `PayPal <https://paypal.com/>`__
#. Open *Reports > Activity download*
#. Go to `PayPal <https://business.paypal.com/merchantdata/reportHome/>`__
#. Open *Activity download*
#. Set *Transaction type* to *Balance affecting*
#. Set *Format* to *CSV*
#. Select date range of interest and click *Create report*
@@ -81,7 +81,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-statement-import/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 <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_paypal%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_paypal%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@@ -103,6 +103,7 @@ Contributors
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Victor M.M. Torres <victor.martin@tecnativa.com>
* Carlos Roca
* Alexey Pelykh <alexey.pelykh@brainbeanapps.com>
@@ -119,6 +120,6 @@ 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 <https://github.com/OCA/bank-statement-import/tree/12.0/account_bank_statement_import_paypal>`_ project on GitHub.
This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/13.0/account_bank_statement_import_paypal>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -6,7 +6,7 @@
{
"name": "PayPal CSV Format Bank Statements Import",
"summary": "Import PayPal CSV files as Bank Statements in Odoo",
"version": "12.0.2.2.1",
"version": "13.0.1.0.0",
"category": "Accounting",
"website": "https://github.com/OCA/bank-statement-import",
"author": "Akretion, " "Brainbean Apps, " "Odoo Community Association (OCA)",

View File

@@ -1,103 +0,0 @@
# Copyright 2020 Brainbean Apps (https://brainbeanapps.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
openupgrade.logged_query(
env.cr,
"""
WITH _mappings AS (
SELECT
m.id,
l.field_to_assign,
l.name,
l.date_format
FROM
account_bank_statement_import_paypal_map AS m
RIGHT OUTER JOIN (
SELECT
*,
ROW_NUMBER() OVER (
PARTITION BY map_parent_id, field_to_assign
ORDER BY id ASC
) AS row_number
FROM account_bank_statement_import_paypal_map_line
WHERE field_to_assign IS NOT NULL
) AS l ON m.id = l.map_parent_id AND l.row_number = 1
)
INSERT INTO account_bank_statement_import_paypal_mapping (
name,
float_thousands_sep,
float_decimal_sep,
date_format,
time_format,
date_column,
time_column,
tz_column,
name_column,
currency_column,
gross_column,
fee_column,
balance_column,
transaction_id_column,
description_column,
from_email_address_column,
invoice_id_column,
bank_name_column,
bank_account_column
)
SELECT
m.name,
m.float_thousands_sep,
m.float_decimal_sep,
COALESCE(_date.date_format, '%m/%d/%Y') AS date_format,
'%H:%M:%S' AS time_format,
COALESCE(_date.name, 'Date') AS date_column,
COALESCE(_time.name, 'Time') AS time_column,
'Time Zone' AS tz_column,
COALESCE(_name.name, 'Name') AS name_column,
COALESCE(_currency.name, 'Currency') AS currency_column,
COALESCE(_gross.name, 'Gross') AS gross_column,
COALESCE(_fee.name, 'Fee') AS fee_column,
COALESCE(_balance.name, 'Balance') AS balance_column,
COALESCE(_tid.name, 'Transaction ID') AS transaction_id_column,
COALESCE(_description.name, 'Description') AS description_column,
COALESCE(_from_email.name, 'From Email Address')
AS from_email_address_column,
COALESCE(_invoice.name, 'Invoice ID') AS invoice_id_column,
COALESCE(_bank_name.name, 'Bank Name') AS bank_name_column,
COALESCE(_bank_acc.name, 'Bank Account') AS bank_account_column
FROM
account_bank_statement_import_paypal_map AS m
LEFT JOIN _mappings AS _date
ON m.id = _date.id AND _date.field_to_assign = 'date'
LEFT JOIN _mappings AS _time
ON m.id = _time.id AND _time.field_to_assign = 'time'
LEFT JOIN _mappings AS _name
ON m.id = _name.id AND _name.field_to_assign = 'partner_name'
LEFT JOIN _mappings AS _currency
ON m.id = _currency.id AND _currency.field_to_assign = 'currency'
LEFT JOIN _mappings AS _gross
ON m.id = _gross.id AND _gross.field_to_assign = 'amount'
LEFT JOIN _mappings AS _fee
ON m.id = _fee.id AND _fee.field_to_assign = 'commission'
LEFT JOIN _mappings AS _balance
ON m.id = _balance.id AND _balance.field_to_assign = 'balance'
LEFT JOIN _mappings AS _tid
ON m.id = _tid.id AND _tid.field_to_assign = 'transaction_id'
LEFT JOIN _mappings AS _description
ON m.id = _description.id AND _description.field_to_assign = 'description'
LEFT JOIN _mappings AS _from_email
ON m.id = _from_email.id AND _from_email.field_to_assign = 'email'
LEFT JOIN _mappings AS _invoice
ON m.id = _invoice.id AND _invoice.field_to_assign = 'invoice_number'
LEFT JOIN _mappings AS _bank_name
ON m.id = _bank_name.id AND _bank_name.field_to_assign = 'bank_name'
LEFT JOIN _mappings AS _bank_acc
ON m.id = _bank_acc.id AND _bank_acc.field_to_assign = 'bank_account';
""",
)

View File

@@ -5,7 +5,7 @@
import logging
from odoo import api, fields, models
from odoo import fields, models
_logger = logging.getLogger(__name__)
@@ -18,12 +18,13 @@ class AccountBankStatementImport(models.TransientModel):
comodel_name="account.bank.statement.import.paypal.mapping",
)
@api.multi
def _parse_file(self, data_file):
self.ensure_one()
try:
Parser = self.env["account.bank.statement.import.paypal.parser"]
return Parser.parse(self.paypal_mapping_id, data_file, self.filename)
return Parser.parse(
self.paypal_mapping_id, data_file, self.attachment_ids[:1].name
)
except Exception:
if self.env.context.get("account_bank_statement_import_paypal_test"):
raise

View File

@@ -59,7 +59,6 @@ class AccountBankStatementImportPayPalMapping(models.Model):
elif "comma" == self.float_thousands_sep == self.float_decimal_sep:
self.float_thousands_sep = "dot"
@api.multi
def _get_float_separators(self):
self.ensure_one()
separators = {

View File

@@ -70,136 +70,107 @@ class AccountBankStatementImportPayPalParser(models.TransientModel):
],
)
def _data_dict_constructor(self, mapping, header):
list_of_content = [
"date_column",
"time_column",
"tz_column",
"name_column",
"currency_column",
"gross_column",
"fee_column",
"balance_column",
"transaction_id_column",
"description_column",
"type_column",
"from_email_address_column",
"to_email_address_column",
"invoice_id_column",
"subject_column",
"note_column",
"bank_name_column",
"bank_account_column",
]
data_dict = {}
for key in list_of_content:
try:
data_dict[key] = header.index(getattr(mapping, key))
except ValueError:
data_dict[key] = None
return data_dict
def _parse_lines(self, mapping, data_file, currency_code):
data = StringIO(data_file.decode("utf-8-sig"))
csv_data = reader(data)
header = list(next(csv_data))
date_column = header.index(mapping.date_column)
time_column = header.index(mapping.time_column)
tz_column = header.index(mapping.tz_column)
name_column = header.index(mapping.name_column)
currency_column = header.index(mapping.currency_column)
gross_column = header.index(mapping.gross_column)
fee_column = header.index(mapping.fee_column)
balance_column = header.index(mapping.balance_column)
transaction_id_column = header.index(mapping.transaction_id_column)
try:
description_column = header.index(mapping.description_column)
except ValueError:
description_column = None
try:
type_column = header.index(mapping.type_column)
except ValueError:
type_column = None
try:
from_email_address_column = header.index(mapping.from_email_address_column)
except ValueError:
from_email_address_column = None
try:
to_email_address_column = header.index(mapping.to_email_address_column)
except ValueError:
to_email_address_column = None
try:
invoice_id_column = header.index(mapping.invoice_id_column)
except ValueError:
invoice_id_column = None
try:
subject_column = header.index(mapping.subject_column)
except ValueError:
subject_column = None
try:
note_column = header.index(mapping.note_column)
except ValueError:
note_column = None
try:
bank_name_column = header.index(mapping.bank_name_column)
except ValueError:
bank_name_column = None
try:
bank_account_column = header.index(mapping.bank_account_column)
except ValueError:
bank_account_column = None
data_dict = self._data_dict_constructor(mapping, header)
return self._calculate_lines(csv_data, data_dict, mapping, currency_code)
def _calculate_lines(self, csv_data, data_dict, mapping, currency_code):
lines = []
for row in csv_data:
row = list(row)
date_value = row[date_column]
time_value = row[time_column]
tz_value = row[tz_column]
name_value = row[name_column]
currency_value = row[currency_column]
gross_value = row[gross_column]
fee_value = row[fee_column]
balance_value = row[balance_column]
transaction_id_value = row[transaction_id_column]
description_value = (
row[description_column] if description_column is not None else None
)
type_value = row[type_column] if type_column is not None else None
from_email_address_value = (
row[from_email_address_column]
if from_email_address_column is not None
else None
)
to_email_address_value = (
row[to_email_address_column]
if to_email_address_column is not None
else None
)
invoice_id_value = (
row[invoice_id_column] if invoice_id_column is not None else None
)
subject_value = row[subject_column] if subject_column is not None else None
note_value = row[note_column] if note_column is not None else None
bank_name_value = (
row[bank_name_column] if bank_name_column is not None else None
)
bank_account_value = (
row[bank_account_column] if bank_account_column is not None else None
)
if currency_value != currency_code:
dict_values = {}
for key in data_dict:
dict_values[key] = (
row[data_dict.get(key)] if data_dict.get(key) is not None else None
)
if dict_values.get("currency_column") != currency_code:
continue
date = datetime.strptime(date_value, mapping.date_format).date()
time = datetime.strptime(time_value, mapping.time_format).time()
date = datetime.strptime(
dict_values.get("date_column"), mapping.date_format
).date()
time = datetime.strptime(
dict_values.get("time_column"), mapping.time_format
).time()
timestamp = datetime.combine(date, time)
tz_value = self._normalize_tz(tz_value)
tz_value = self._normalize_tz(dict_values.get("tz_column"))
tz = timezone(tz_value)
timestamp = timestamp.replace(tzinfo=tz)
timestamp = timestamp.astimezone(utc).replace(tzinfo=None)
gross_amount = self._parse_decimal(gross_value, mapping)
fee_amount = self._parse_decimal(fee_value, mapping)
balance_amount = self._parse_decimal(balance_value, mapping)
gross_amount = self._parse_decimal(dict_values.get("gross_column"), mapping)
fee_amount = self._parse_decimal(dict_values.get("fee_column"), mapping)
balance_amount = self._parse_decimal(
dict_values.get("balance_column"), mapping
)
bank = (
"{} - {}".format(bank_name_value, bank_account_value)
if bank_name_value and bank_account_value
"{} - {}".format(
dict_values.get("bank_name_column"),
dict_values.get("bank_account_column"),
)
if dict_values.get("bank_name_column")
and dict_values.get("bank_account_column")
else None
)
if to_email_address_column is None:
payer_email = from_email_address_value
if data_dict.get("to_email_address_column") is None:
payer_email = dict_values.get("from_email_address_column")
else:
payer_email = (
to_email_address_value
dict_values.get("to_email_address_column")
if gross_amount < 0.0
else from_email_address_value
else dict_values.get("from_email_address_column")
)
lines.append(
{
"transaction_id": transaction_id_value,
"invoice": invoice_id_value,
"description": description_value or type_value,
"details": subject_value or note_value or bank,
"transaction_id": dict_values.get("transaction_id_column"),
"invoice": dict_values.get("invoice_id_column"),
"description": dict_values.get("description_column")
or dict_values.get("type_column"),
"details": dict_values.get("subject_column")
or dict_values.get("note_column")
or bank,
"timestamp": timestamp,
"gross_amount": gross_amount,
"fee_amount": fee_amount,
"balance_amount": balance_amount,
"payer_name": name_value,
"payer_name": dict_values.get("name_column"),
"payer_email": payer_email,
"partner_bank_name": bank_name_value,
"partner_bank_account": bank_account_value,
"partner_bank_name": dict_values.get("bank_name_column"),
"partner_bank_account": dict_values.get("bank_account_column"),
}
)
return lines

View File

@@ -4,5 +4,6 @@
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Victor M.M. Torres <victor.martin@tecnativa.com>
* Carlos Roca
* Alexey Pelykh <alexey.pelykh@brainbeanapps.com>

View File

@@ -1,7 +1,7 @@
To import statements from PayPal via Statement report:
#. Go to `PayPal <https://paypal.com/>`__
#. Open *Reports > Statements* and select *Monthly* or *Custom*
#. Go to `PayPal <https://business.paypal.com/merchantdata/reportHome/>`__
#. Open *Statements* and select *Monthly* or *Custom*
#. Select date range of interest and click *Request* under *CSV* column
#. Wait for statement report to be generated
#. Download it and save to a file
@@ -9,8 +9,8 @@ To import statements from PayPal via Statement report:
To import statements from PayPal via Activity report:
#. Go to `PayPal <https://paypal.com/>`__
#. Open *Reports > Activity download*
#. Go to `PayPal <https://business.paypal.com/merchantdata/reportHome/>`__
#. Open *Activity download*
#. Set *Transaction type* to *Balance affecting*
#. Set *Format* to *CSV*
#. Select date range of interest and click *Create report*

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/12.0/account_bank_statement_import_paypal"><img alt="OCA/bank-statement-import" src="https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-statement-import-12-0/bank-statement-import-12-0-account_bank_statement_import_paypal"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/174/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/13.0/account_bank_statement_import_paypal"><img alt="OCA/bank-statement-import" src="https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-statement-import-13-0/bank-statement-import-13-0-account_bank_statement_import_paypal"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/174/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to import the PayPal CSV files in Odoo as bank
statements.</p>
<p><strong>Table of contents</strong></p>
@@ -400,8 +400,8 @@ statements.</p>
<h1><a class="toc-backref" href="#id3">Usage</a></h1>
<p>To import statements from PayPal via Statement report:</p>
<ol class="arabic simple">
<li>Go to <a class="reference external" href="https://paypal.com/">PayPal</a></li>
<li>Open <em>Reports &gt; Statements</em> and select <em>Monthly</em> or <em>Custom</em></li>
<li>Go to <a class="reference external" href="https://business.paypal.com/merchantdata/reportHome/">PayPal</a></li>
<li>Open <em>Statements</em> and select <em>Monthly</em> or <em>Custom</em></li>
<li>Select date range of interest and click <em>Request</em> under <em>CSV</em> column</li>
<li>Wait for statement report to be generated</li>
<li>Download it and save to a file</li>
@@ -409,8 +409,8 @@ statements.</p>
</ol>
<p>To import statements from PayPal via Activity report:</p>
<ol class="arabic simple">
<li>Go to <a class="reference external" href="https://paypal.com/">PayPal</a></li>
<li>Open <em>Reports &gt; Activity download</em></li>
<li>Go to <a class="reference external" href="https://business.paypal.com/merchantdata/reportHome/">PayPal</a></li>
<li>Open <em>Activity download</em></li>
<li>Set <em>Transaction type</em> to <em>Balance affecting</em></li>
<li>Set <em>Format</em> to <em>CSV</em></li>
<li>Select date range of interest and click <em>Create report</em></li>
@@ -436,7 +436,7 @@ statements.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-statement-import/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_paypal%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_paypal%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -456,6 +456,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Tecnativa (<a class="reference external" href="https://www.tecnativa.com">https://www.tecnativa.com</a>)<ul>
<li>Vicent Cubells &lt;<a class="reference external" href="mailto:vicent.cubells&#64;tecnativa.com">vicent.cubells&#64;tecnativa.com</a>&gt;</li>
<li>Victor M.M. Torres &lt;<a class="reference external" href="mailto:victor.martin&#64;tecnativa.com">victor.martin&#64;tecnativa.com</a>&gt;</li>
<li>Carlos Roca</li>
</ul>
</li>
<li>Alexey Pelykh &lt;<a class="reference external" href="mailto:alexey.pelykh&#64;brainbeanapps.com">alexey.pelykh&#64;brainbeanapps.com</a>&gt;</li>
@@ -468,7 +469,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/12.0/account_bank_statement_import_paypal">OCA/bank-statement-import</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/13.0/account_bank_statement_import_paypal">OCA/bank-statement-import</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -53,8 +53,16 @@ class TestAccountBankStatementImportPayPal(common.TransactionCase):
{"journal_id": journal.id}
).create(
{
"filename": "fixtures/statement_en.csv",
"data_file": self._data_file("fixtures/statement_en.csv"),
"attachment_ids": [
(
0,
0,
{
"name": "fixtures/statement_en.csv",
"datas": self._data_file("fixtures/statement_en.csv"),
},
)
],
"paypal_mapping_id": self.paypal_statement_map_en.id,
}
)
@@ -81,8 +89,16 @@ class TestAccountBankStatementImportPayPal(common.TransactionCase):
{"journal_id": journal.id}
).create(
{
"filename": "fixtures/statement_en.csv",
"data_file": self._data_file("fixtures/statement_en.csv"),
"attachment_ids": [
(
0,
0,
{
"name": "fixtures/statement_en.csv",
"datas": self._data_file("fixtures/statement_en.csv"),
},
)
],
"paypal_mapping_id": self.paypal_statement_map_en.id,
}
)
@@ -109,8 +125,16 @@ class TestAccountBankStatementImportPayPal(common.TransactionCase):
{"journal_id": journal.id}
).create(
{
"filename": "fixtures/statement_es.csv",
"data_file": self._data_file("fixtures/statement_es.csv"),
"attachment_ids": [
(
0,
0,
{
"name": "fixtures/statement_es.csv",
"datas": self._data_file("fixtures/statement_es.csv"),
},
)
],
"paypal_mapping_id": self.paypal_statement_map_es.id,
}
)
@@ -137,8 +161,16 @@ class TestAccountBankStatementImportPayPal(common.TransactionCase):
{"journal_id": journal.id}
).create(
{
"filename": "fixtures/activity_en.csv",
"data_file": self._data_file("fixtures/activity_en.csv"),
"attachment_ids": [
(
0,
0,
{
"name": "fixtures/activity_en.csv",
"datas": self._data_file("fixtures/activity_en.csv"),
},
)
],
"paypal_mapping_id": self.paypal_activity_map_en.id,
}
)
@@ -165,8 +197,16 @@ class TestAccountBankStatementImportPayPal(common.TransactionCase):
{"journal_id": journal.id}
).create(
{
"filename": "fixtures/empty_activity.csv",
"data_file": self._data_file("fixtures/empty_activity.csv"),
"attachment_ids": [
(
0,
0,
{
"name": "fixtures/empty_activity.csv",
"datas": self._data_file("fixtures/empty_activity.csv"),
},
)
],
"paypal_mapping_id": self.paypal_activity_map_en.id,
}
)

View File

@@ -66,7 +66,6 @@
>
<field name="name">PayPal Report Mappings</field>
<field name="res_model">account.bank.statement.import.paypal.mapping</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem

View File

@@ -83,7 +83,6 @@ class AccountBankStatementImportPayPalMappingWizard(models.TransientModel):
return []
return [(x, x) for x in json.loads(header)]
@api.multi
def _get_mapping_values(self):
"""Hook for extension"""
self.ensure_one()
@@ -113,7 +112,6 @@ class AccountBankStatementImportPayPalMappingWizard(models.TransientModel):
"bank_account_column": self.bank_account_column,
}
@api.multi
def import_mapping(self):
self.ensure_one()
mapping = self.env["account.bank.statement.import.paypal.mapping"].create(

View File

@@ -166,9 +166,9 @@
id="action_account_bank_statement_import_paypal_mapping_wizard"
name="Import Mapping"
res_model="account.bank.statement.import.paypal.mapping.wizard"
src_model="account.bank.statement.import.paypal.mapping"
binding_model="account.bank.statement.import.paypal.mapping"
view_mode="form"
target="new"
key2="client_action_multi"
binding_views="form"
/>
</odoo>

View File

@@ -0,0 +1 @@
../../../../account_bank_statement_import_paypal

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)