-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from akretion/18-import-helper
[MIG][18.0] import_helper_base
- Loading branch information
Showing
11 changed files
with
434 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,8 @@ | ||
================== | ||
Import Helper Base | ||
================== | ||
|
||
This is a technical module that contains common code for several import helper modules: | ||
|
||
* partner_import_helper | ||
* product_import_helper |
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 @@ | ||
from . import wizards |
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 @@ | ||
# 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, | ||
} |
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,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
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 @@ | ||
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 |
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 @@ | ||
from . import test_import_helper |
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,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) |
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 @@ | ||
from . import import_helper |
Oops, something went wrong.