-
-
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.
[IMP] Add module to map product taxes.
- Loading branch information
1 parent
2aea27d
commit f1633a0
Showing
6 changed files
with
79 additions
and
0 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,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Comunitea | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from . import models |
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,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Comunitea | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'Magento Connector Product Tax', | ||
'version': "8.0.1.0.0", | ||
'category': 'Connector', | ||
'description': """ | ||
Maps product taxes based on their magento id | ||
""", | ||
'author': 'Factor Libre S.L., Odoo Community Association (OCA)', | ||
'website': 'http://www.factorlibre.com/', | ||
'license': 'AGPL-3', | ||
'depends': [ | ||
'magentoerpconnect', | ||
'account', | ||
], | ||
'data': ['views/account_view.xml'], | ||
'application': False, | ||
'installable': True, | ||
} |
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,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Comunitea | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from . import account | ||
from . import product |
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,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Comunitea | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp import models, fields | ||
|
||
|
||
class AccountTax(models.Model): | ||
_inherit = 'account.tax' | ||
|
||
magento_tax_id = fields.Integer('Magento Tax ID') |
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,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Comunitea | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp.addons.connector.unit.mapper import mapping | ||
from openerp.addons.magentoerpconnect.product import ProductImportMapper | ||
from openerp.addons.magentoerpconnect.backend import magento1700 | ||
|
||
|
||
@magento1700 | ||
class TaxProductImportMapper(ProductImportMapper): | ||
_model_name = 'magento.product.product' | ||
|
||
@mapping | ||
def tax_id(self, record): | ||
tax_class_id = record.get('tax_class_id', '-1') | ||
tax = self.session.env['account.tax'].search( | ||
[('magento_tax_id', '=', tax_class_id)]) | ||
result = {'taxes_id': [(6, 0, tax.ids)]} | ||
return result |
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,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- © 2016 Comunitea | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
<openerp> | ||
<data> | ||
<record id="account_tax_magento_connector_form_view" model="ir.ui.view"> | ||
<field name="name">account.tax.form</field> | ||
<field name="model">account.tax</field> | ||
<field name="inherit_id" ref="account.view_tax_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="child_depend" position="after"> | ||
<field name="magento_tax_id"/> | ||
</field> | ||
</field> | ||
</record> | ||
</data> | ||
</openerp> |