-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
700 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
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,114 @@ | ||
=============== | ||
Company Country | ||
=============== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github | ||
:target: https://github.com/OCA/server-tools/tree/12.0/company_country | ||
:alt: OCA/server-tools | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-company_country | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/149/12.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allow set a country to main company in order to use the hook of | ||
account that install l10n_** based on country of main company. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
#. Add as depends from your main module. | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
#. Set the environment variable COUNTRY using 2 letter of ISO 3166 codes. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Just start server installing your main module. | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/149/12.0 | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/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 <https://github.com/OCA/server-tools/issues/new?body=module:%20company_country%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Vauxoo | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Moisés López <moylop260@vauxoo.com> | ||
|
||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
|
||
Vauxoo | ||
|
||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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. | ||
|
||
.. |maintainer-moylop260| image:: https://github.com/moylop260.png?size=40px | ||
:target: https://github.com/moylop260 | ||
:alt: moylop260 | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-moylop260| | ||
|
||
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/12.0/company_country>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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 @@ | ||
# Copyright 2016 Vauxoo | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from . import models | ||
from . import tests |
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 @@ | ||
# © 2016 Vauxoo (<http://www.vauxoo.com/>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Company Country", | ||
"summary": "Set country to main company", | ||
"version": "12.0.1.0.0", | ||
"category": "base", | ||
"website": "https://github.com/OCA/server-tools/tree/12.0/company_country", | ||
"maintainers": ['moylop260'], | ||
"author": "Vauxoo, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"depends": [], | ||
"data": ['data/res_config.xml'], | ||
"sequence": 1, | ||
"auto_install": 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,6 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<odoo noupdate="1"> | ||
|
||
<function name="load_company_country" model="company.country.config.settings"/> | ||
|
||
</odoo> |
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 @@ | ||
# Copyright 2016 Vauxoo | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from . import res_config |
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,35 @@ | ||
# Copyright 2016 Vauxoo | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
import os | ||
|
||
from odoo import _, api, models | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class CompanyCountryConfigSettings(models.TransientModel): | ||
_name = 'company.country.config.settings' | ||
_description = 'Company Country Configuration Settings' | ||
|
||
@api.model | ||
def load_company_country(self, country_code=None): | ||
if not country_code: | ||
country_code = os.environ.get('COUNTRY') | ||
if country_code == "": | ||
self.env.ref('base.main_company').write({'country_id': None}) | ||
return | ||
if not country_code: | ||
l10n_to_install = self.env['ir.module.module'].search([ | ||
('state', '=', 'to install'), | ||
('name', '=like', 'l10n_%')], limit=1) | ||
if not l10n_to_install: | ||
raise ValidationError( | ||
_('Error COUNTRY environment variable with country code ' | ||
'not defined and no localization found in pool.')) | ||
country_code = l10n_to_install.name.split('l10n_')[1][:2].upper() | ||
|
||
country = self.env['res.country'].search([ | ||
('code', 'ilike', country_code)], limit=1) | ||
if not country: | ||
raise ValidationError( | ||
_('Country code %s not found. Use ISO 3166 codes 2 letters')) | ||
self.env.ref('base.main_company').write({'country_id': country.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,3 @@ | ||
To configure this module, you need to: | ||
|
||
#. Set the environment variable COUNTRY using 2 letter of ISO 3166 codes. |
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 @@ | ||
* Moisés López <moylop260@vauxoo.com> | ||
|
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 @@ | ||
Vauxoo | ||
|
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 @@ | ||
This module allow set a country to main company in order to use the hook of | ||
account that install l10n_** based on country of main company. |
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 @@ | ||
To install this module, you need to: | ||
|
||
#. Add as depends from your main module. |
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,7 @@ | ||
To use this module, you need to: | ||
|
||
#. Just start server installing your main module. | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/149/12.0 |
Oops, something went wrong.