-
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] connector_magento_payment_ref: Migration to 10.0
- Loading branch information
Showing
22 changed files
with
1,118 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
|
||
=================================== | ||
Connector Magento Payment Reference | ||
=================================== | ||
|
||
This module let's you define on the payment method the path to a value to use as transaction id into | ||
the informations of a sale order returned as json by magento and map this information into | ||
the transaction_id field defined by OCA/bank-statement-reconcile/base_transaction_id. | ||
|
||
The main purpose is to ease the reconciliation process. | ||
|
||
Configuration | ||
============= | ||
|
||
For each payment method, you can define the path to the transaction_id value in | ||
the informations provided by magento. | ||
|
||
|
||
Usage | ||
===== | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/107/10.0 | ||
|
||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/connector-magento/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. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Laurent Mignon <[email protected]> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
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. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
1 change: 1 addition & 0 deletions
1
magentoerpconnect_transaction_id/__init__.py → connector_magento_payment_ref/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
from . import models | ||
from . import components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
from . import sale_order_import_mapper |
25 changes: 25 additions & 0 deletions
25
connector_magento_payment_ref/components/sale_order_import_mapper.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
from odoo.addons.component.core import Component | ||
from odoo.addons.connector.components.mapper import mapping | ||
|
||
|
||
class SaleOrderImportMapper(Component): | ||
_inherit = 'magento.sale.order.mapper' | ||
|
||
@mapping | ||
def payment(self, record): | ||
vals = super(SaleOrderImportMapper, self).payment(record) | ||
payment_mode_id = vals.get('payment_mode_id') | ||
if payment_mode_id: | ||
payment_mode = self.env['account.payment.mode'].browse( | ||
payment_mode_id) | ||
if payment_mode.transaction_id_path: | ||
value = record | ||
for key in payment_mode.transaction_id_path.split('.'): | ||
value = value.get(key) | ||
if not value: | ||
break | ||
vals['transaction_id'] = value | ||
return vals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
from . import account_payment_mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
from . import test_sale_order |
948 changes: 948 additions & 0 deletions
948
connector_magento_payment_ref/tests/fixtures/cassettes/import_sale_order_transaction_id.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from os.path import dirname, join | ||
from odoo.addons.connector_magento.tests.common import MagentoSyncTestCase, \ | ||
recorder | ||
|
||
CASSETTE_LIBRARY_DIR = join(dirname(__file__), 'fixtures/cassettes') | ||
|
||
|
||
class TestSaleOrder(MagentoSyncTestCase): | ||
""" Test the imports from a Magento Mock. | ||
""" | ||
|
||
def setUp(self): | ||
super(TestSaleOrder, self).setUp() | ||
self.payment_method = self.env['account.payment.mode'].search( | ||
[('name', '=', 'checkmo')], | ||
limit=1, | ||
) | ||
|
||
def _import_sale_order(self, increment_id, cassette=True): | ||
return self._import_record('magento.sale.order', | ||
increment_id, cassette=cassette) | ||
|
||
def test_transaction_id_mapping(self): | ||
""" Test import of sale order with a payment transaction id""" | ||
self.payment_method.transaction_id_path = 'payment.transaction_id' | ||
with recorder.use_cassette('import_sale_order_transaction_id', | ||
cassette_library_dir=CASSETTE_LIBRARY_DIR): | ||
binding = self._import_sale_order(100000201, cassette=False) | ||
self.assertEqual(binding.transaction_id, '951') | ||
|
||
def test_transaction_id_mapping_wrong_path(self): | ||
""" Test import of sale order with a wrong path to the | ||
transaction_id""" | ||
self.payment_method.transaction_id_path = 'payment.trans' | ||
with recorder.use_cassette('import_sale_order_transaction_id', | ||
cassette_library_dir=CASSETTE_LIBRARY_DIR): | ||
binding = self._import_sale_order(100000201, cassette=False) | ||
self.assertEqual(binding.transaction_id, False) |
13 changes: 13 additions & 0 deletions
13
connector_magento_payment_ref/views/account_payment_mode.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="account_payment_mode_form_view" model="ir.ui.view"> | ||
<field name="name">account_payment_mode.form.view (connector_magento_payment_ref)</field> | ||
<field name="model">account.payment.mode</field> | ||
<field name="inherit_id" ref="account_payment_mode.account_payment_mode_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="fixed_journal_id" position="after"> | ||
<field name="transaction_id_path" placeholder="payment.last_trans_id"/> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
67 changes: 0 additions & 67 deletions
67
magentoerpconnect_transaction_id/tests/test_synchronization.py
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
magentoerpconnect_transaction_id/views/payment_method_view.xml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__import__('pkg_resources').declare_namespace(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__import__('pkg_resources').declare_namespace(__name__) |
1 change: 1 addition & 0 deletions
1
setup/connector_magento_payment_ref/odoo/addons/connector_magento_payment_ref
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../connector_magento_payment_ref |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |