Browse Source

[IMP] company_country: Fix and improve README and error messages

Error messages and module description are improved to be more verbose,
and some typos are fixed.
12.0-mig-module_prototyper_last
Luis González 4 years ago
parent
commit
bff84d8c1b
  1. 17
      company_country/README.rst
  2. 28
      company_country/i18n/company_country.pot
  3. 12
      company_country/models/res_config.py
  4. 2
      company_country/readme/CONFIGURE.rst
  5. 1
      company_country/readme/CREDITS.rst
  6. 10
      company_country/readme/DESCRIPTION.rst
  7. 2
      company_country/readme/INSTALL.rst
  8. 2
      company_country/readme/USAGE.rst
  9. 15
      company_country/static/description/index.html

17
company_country/README.rst

@ -25,8 +25,14 @@ Company Country
|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.
This module allows to set a country to the main company before the ``account``
module is installed, so the hook of that module installs the correct
``l10n_***`` module.
This is useful because, if the company isn't already set correctly when the
``account`` module is installed, the generic accounting chart will be installed
(``l10n_generic_coa``), which may be incorrect depending on your company's
country.
**Table of contents**
@ -38,21 +44,21 @@ Installation
To install this module, you need to:
#. Add as depends from your main module.
#. Add it as dependency from your main module.
Configuration
=============
To configure this module, you need to:
#. Set the environment variable COUNTRY using 2 letter of ISO 3166 codes.
#. Set the environment variable ``COUNTRY`` using a two-letter ISO 3166 code.
Usage
=====
To use this module, you need to:
#. Just start server installing your main module.
#. Just start the server installing your main module.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
@ -88,7 +94,6 @@ Other credits
Vauxoo
Maintainers
~~~~~~~~~~~

28
company_country/i18n/company_country.pot

@ -14,34 +14,14 @@ msgstr ""
"Plural-Forms: \n"
#. module: company_country
#: model:ir.model,name:company_country.model_company_country_config_settings
msgid "Company Country Configuration Settings"
msgstr ""
#. module: company_country
#: code:addons/company_country/models/res_config.py:47
#: code:addons/company_country/models/res_config.py:38
#, python-format
msgid "Country code %s not found. Use ISO 3166 codes 2 letters"
msgstr ""
#. module: company_country
#: model:ir.model.fields,field_description:company_country.field_company_country_config_settings__display_name
msgid "Display Name"
msgid "COUNTRY environment variable with country code is not set and no localization module is marked to be installed."
msgstr ""
#. module: company_country
#: code:addons/company_country/models/res_config.py:39
#: code:addons/company_country/models/res_config.py:47
#, python-format
msgid "Error COUNTRY environment variable with country code not defined and no localization found in pool."
msgstr ""
#. module: company_country
#: model:ir.model.fields,field_description:company_country.field_company_country_config_settings__id
msgid "ID"
msgstr ""
#. module: company_country
#: model:ir.model.fields,field_description:company_country.field_company_country_config_settings____last_update
msgid "Last Modified on"
msgid "Country code %s was not found. Please use a valid two-letter ISO 3166 code."
msgstr ""

12
company_country/models/res_config.py

@ -35,14 +35,16 @@ class CompanyCountryConfigSettings(models.AbstractModel):
('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.'))
raise ValidationError(_(
'COUNTRY environment variable with country code is not '
'set and no localization module is marked to be '
'installed.'))
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'))
raise ValidationError(_(
'Country code %s was not found. Please use a valid two-letter '
'ISO 3166 code.'))
self.env.ref('base.main_company').write({'country_id': country.id})

2
company_country/readme/CONFIGURE.rst

@ -1,3 +1,3 @@
To configure this module, you need to:
#. Set the environment variable COUNTRY using 2 letter of ISO 3166 codes.
#. Set the environment variable ``COUNTRY`` using a two-letter ISO 3166 code.

1
company_country/readme/CREDITS.rst

@ -1,2 +1 @@
Vauxoo

10
company_country/readme/DESCRIPTION.rst

@ -1,2 +1,8 @@
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 module allows to set a country to the main company before the ``account``
module is installed, so the hook of that module installs the correct
``l10n_***`` module.
This is useful because, if the company isn't already set correctly when the
``account`` module is installed, the generic accounting chart will be installed
(``l10n_generic_coa``), which may be incorrect depending on your company's
country.

2
company_country/readme/INSTALL.rst

@ -1,3 +1,3 @@
To install this module, you need to:
#. Add as depends from your main module.
#. Add it as dependency from your main module.

2
company_country/readme/USAGE.rst

@ -1,6 +1,6 @@
To use this module, you need to:
#. Just start server installing your main module.
#. Just start the server installing your main module.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot

15
company_country/static/description/index.html

@ -368,8 +368,13 @@ ul.auto-toc {
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-tools/tree/12.0/company_country"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-company_country"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/149/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
<p>This module allows to set a country to the main company before the <tt class="docutils literal">account</tt>
module is installed, so the hook of that module installs the correct
<tt class="docutils literal"><span class="pre">l10n_***</span></tt> module.</p>
<p>This is useful because, if the company isn’t already set correctly when the
<tt class="docutils literal">account</tt> module is installed, the generic accounting chart will be installed
(<tt class="docutils literal">l10n_generic_coa</tt>), which may be incorrect depending on your company’s
country.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@ -390,21 +395,21 @@ account that install l10n_** based on country of main company.</p>
<h1><a class="toc-backref" href="#id1">Installation</a></h1>
<p>To install this module, you need to:</p>
<ol class="arabic simple">
<li>Add as depends from your main module.</li>
<li>Add it as dependency from your main module.</li>
</ol>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id2">Configuration</a></h1>
<p>To configure this module, you need to:</p>
<ol class="arabic simple">
<li>Set the environment variable COUNTRY using 2 letter of ISO 3166 codes.</li>
<li>Set the environment variable <tt class="docutils literal">COUNTRY</tt> using a two-letter ISO 3166 code.</li>
</ol>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id3">Usage</a></h1>
<p>To use this module, you need to:</p>
<ol class="arabic simple">
<li>Just start server installing your main module.</li>
<li>Just start the server installing your main module.</li>
</ol>
<a class="reference external image-reference" href="https://runbot.odoo-community.org/runbot/149/12.0"><img alt="Try me on Runbot" src="https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas" /></a>
</div>

Loading…
Cancel
Save