Skip to content

Commit

Permalink
Merge pull request #12 from akretion/18-import-helper
Browse files Browse the repository at this point in the history
[MIG][18.0] import_helper_base
  • Loading branch information
alexis-via authored Nov 26, 2024
2 parents 432389d + d3f74ec commit 741bca8
Show file tree
Hide file tree
Showing 11 changed files with 434 additions and 0 deletions.
8 changes: 8 additions & 0 deletions import_helper_base/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
==================
Import Helper Base
==================

This is a technical module that contains common code for several import helper modules:

* partner_import_helper
* product_import_helper
1 change: 1 addition & 0 deletions import_helper_base/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import wizards
22 changes: 22 additions & 0 deletions import_helper_base/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2023 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Import Helper Base",
"version": "18.0.1.0.0",
"category": "Extra Tools",
"license": "AGPL-3",
"summary": "Common code for all import helper modules",
"author": "Akretion",
"website": "https://github.com/Akretion/odoo-import-helper",
"depends": [
"base",
],
"external_dependencies": {"python": ["pycountry", "openai", "unidecode"]},
"data": [
"security/ir.model.access.csv",
"wizards/import_helper_view.xml",
],
"installable": True,
}
3 changes: 3 additions & 0 deletions import_helper_base/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions import_helper_base/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_import_helper_full,Full access on import.helper wizard,model_import_helper,base.group_user,1,1,1,1
1 change: 1 addition & 0 deletions import_helper_base/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_import_helper
45 changes: 45 additions & 0 deletions import_helper_base/tests/test_import_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2023 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests.common import TransactionCase


class TestBaseImportHelper(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
# create data

def test_match_country(self):
iho = self.env["import.helper"]
speedy = iho._prepare_speedy()
country_id = iho._match_country(
{"country_name": "fr"}, "country_name", "res.partner", "country_id", speedy
)
self.assertEqual(country_id, self.env.ref("base.fr").id)
country_id = iho._match_country(
{"country_name": "FRA"}, "country_name", "res.partner", "country_id", speedy
)
self.assertEqual(country_id, self.env.ref("base.fr").id)
country_id = iho._match_country(
{"country_name": "France"},
"country_name",
"res.partner",
"country_id",
speedy,
)
self.assertEqual(country_id, self.env.ref("base.fr").id)
country_id = iho._match_country(
{"country_name": "U.S.A."},
"country_name",
"res.partner",
"country_id",
speedy,
)
self.assertEqual(country_id, self.env.ref("base.us").id)
# country_id = iho._match_country(
# {"country_name": "España"}, "country_name", "res.partner",
# "country_id", speedy)
# self.assertEqual(country_id, self.env.ref('base.es').id)
1 change: 1 addition & 0 deletions import_helper_base/wizards/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import import_helper
Loading

0 comments on commit 741bca8

Please sign in to comment.