Skip to content

Commit 3001e46

Browse files
committed
[MIG] connector_magento_payment_ref: Migration to 10.0
1 parent 2a457d4 commit 3001e46

File tree

22 files changed

+1119
-178
lines changed

22 files changed

+1119
-178
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
3+
:alt: License: AGPL-3
4+
5+
6+
===================================
7+
Connector Magento Payment Reference
8+
===================================
9+
10+
This module let's you define on the payment method the path to a value to use as transaction id into
11+
the informations of a sale order returned as json by magento and map this information into
12+
the transaction_id field defined by OCA/bank-statement-reconcile/base_transaction_id.
13+
14+
The main purpose is to ease the reconciliation process.
15+
16+
Configuration
17+
=============
18+
19+
For each payment method, you can define the path to the transaction_id value in
20+
the informations provided by magento.
21+
22+
23+
Usage
24+
=====
25+
26+
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
27+
:alt: Try me on Runbot
28+
:target: https://runbot.odoo-community.org/runbot/107/10.0
29+
30+
31+
Bug Tracker
32+
===========
33+
34+
Bugs are tracked on `GitHub Issues
35+
<https://github.com/OCA/connector-magento/issues>`_. In case of trouble, please
36+
check there if your issue has already been reported. If you spotted it first,
37+
help us smashing it by providing a detailed and welcomed feedback.
38+
39+
Credits
40+
=======
41+
42+
Images
43+
------
44+
45+
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
46+
47+
Contributors
48+
------------
49+
50+
* Laurent Mignon <[email protected]>
51+
52+
Maintainer
53+
----------
54+
55+
.. image:: https://odoo-community.org/logo.png
56+
:alt: Odoo Community Association
57+
:target: https://odoo-community.org
58+
59+
This module is maintained by the OCA.
60+
61+
OCA, or the Odoo Community Association, is a nonprofit organization whose
62+
mission is to support the collaborative development of Odoo features and
63+
promote its widespread use.
64+
65+
To contribute to this module, please visit https://odoo-community.org.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# -*- coding: utf-8 -*-
22
from . import models
3+
from . import components

magentoerpconnect_transaction_id/__openerp__.py renamed to connector_magento_payment_ref/__manifest__.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
Map the payment identifier in your sale order""",
88
'author': 'ACSONE SA/NV,'
99
'Odoo Community Association (OCA)',
10-
'website': "http://acsone.eu",
10+
'website': 'https://github.com/OCA/connector-magento',
1111
'category': 'Connector',
12-
'version': '8.0.1.0.0',
12+
'version': '10.0.1.0.0',
1313
'license': 'AGPL-3',
1414
'depends': [
15-
'magentoerpconnect',
16-
'sale_payment_method',
15+
'component',
16+
'connector',
17+
'connector_magento',
18+
'account_payment_mode',
1719
'base_transaction_id',
20+
'sale_automatic_workflow_payment_ref',
1821
],
1922
'data': [
20-
'views/payment_method_view.xml',
23+
'views/account_payment_mode.xml',
2124
],
2225
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# -*- coding: utf-8 -*-
2+
from . import sale_order_import_mapper
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>)
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
4+
from odoo.addons.component.core import Component
5+
from odoo.addons.connector.components.mapper import mapping
6+
7+
8+
class SaleOrderImportMapper(Component):
9+
_inherit = 'magento.sale.order.mapper'
10+
11+
@mapping
12+
def payment(self, record):
13+
vals = super(SaleOrderImportMapper, self).payment(record)
14+
payment_mode_id = vals.get('payment_mode_id')
15+
if payment_mode_id:
16+
payment_mode = self.env['account.payment.mode'].browse(
17+
payment_mode_id)
18+
if payment_mode.transaction_id_path:
19+
value = record
20+
for key in payment_mode.transaction_id_path.split('.'):
21+
value = value.get(key)
22+
if not value:
23+
break
24+
vals['transaction_id'] = value
25+
return vals
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# -*- coding: utf-8 -*-
2+
from . import account_payment_mode

magentoerpconnect_transaction_id/models/payment_method.py renamed to connector_magento_payment_ref/models/account_payment_mode.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
from openerp import models, fields
5+
from odoo import models, fields
66

77

8-
class PaymentMethod(models.Model):
9-
_inherit = 'payment.method'
8+
class AccountPaymentMode(models.Model):
9+
_inherit = 'account.payment.mode'
1010

1111
transaction_id_path = fields.Char(
1212
help=('Path to the value into the informations provided by Magento '
9.81 KB
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# -*- coding: utf-8 -*-
2+
from . import test_sale_order

connector_magento_payment_ref/tests/fixtures/cassettes/import_sale_order_transaction_id.yaml

Lines changed: 948 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)