Skip to content

Commit

Permalink
FIX REA fields order (OCA#612)
Browse files Browse the repository at this point in the history
ADD REA fields to copany and compute company_registry accordingly
  • Loading branch information
eLBati authored and TheMule71 committed Nov 2, 2022
1 parent 107507f commit c082e7e
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 24 deletions.
13 changes: 10 additions & 3 deletions l10n_it_rea/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,24 @@ Italian localization - Registro REA
**Italiano**

Questo modulo aggiunge al partner i campi relativi ai dati REA (Repertorio Economico Amministrativo).

http://www.registroimprese.it/codice-fiscale-p.iva-rea

I campi vengono aggiunti nella sezione contabile della scheda del partner, dove è possibile inserire i dati del Registro Imprese.

I dati REA sono anche disponibili nella scheda dell'azienda. Valorizzandoli, il campo 'registro imprese' verrà calcolato di conseguenza.

**English**

This module implement fields of REA data in partner.

http://www.registroimprese.it/codice-fiscale-p.iva-rea

Fields are added on accounting page of partner form, where you can
add data of business register.

REA fields are also available in company form and, filling them, Company Registry will be computed accordingly.

**Table of contents**

.. contents::
Expand Down Expand Up @@ -66,10 +73,10 @@ Authors
Contributors
~~~~~~~~~~~~

* Alessio Gerace <[email protected]>
* Alessio Gerace
* Nicola Malcontenti <[email protected]>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Andrea Gallina <[email protected]>
* Lorenzo Battistini <https://github.com/eLBati>
* Andrea Gallina
* Sergio Zanchetta <[email protected]>

Maintainers
Expand Down
4 changes: 3 additions & 1 deletion l10n_it_rea/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Copyright 2014 Associazione Odoo Italia (<http://www.odoo-italia.org>)
# Copyright 2015 Alessio Gerace <[email protected]>
# Copyright 2016 Andrea Gallina (Apulia Software)
# Copyright 2018 Lorenzo Battistini
# Copyright 2018 Sergio Zanchetta (Associazione PNLUG - Gruppo Odoo)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

{
'name': 'Italian localization - Registro REA',
'version': '11.0.1.0.0',
'category': 'Localisation/Italy',
'summary': 'Manage fields for Economic Administrative catalogue',
'summary': 'Manage fields for Economic Administrative catalogue',
'author': 'Agile Business Group, Odoo Italia Network,'
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/l10n-italy/tree/11.0/l10n_it_rea',
Expand All @@ -18,6 +19,7 @@
],
"data": [
'views/partner_view.xml',
'views/company_view.xml',
],
'installable': True,
}
33 changes: 27 additions & 6 deletions l10n_it_rea/i18n/l10n_it_rea.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
Expand All @@ -14,23 +14,42 @@ msgstr ""
"Plural-Forms: \n"

#. module: l10n_it_rea
#: code:addons/l10n_it_rea/models/res_company.py:49
#, python-format
msgid "%s %s Share Cap. %s € %s %s"
msgstr ""

#. module: l10n_it_rea
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_company_rea_capital
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_partner_rea_capital
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_users_rea_capital
msgid "Capital"
msgstr ""

#. module: l10n_it_rea
#: model:ir.model,name:l10n_it_rea.model_res_company
msgid "Companies"
msgstr ""

#. module: l10n_it_rea
#: model:ir.model,name:l10n_it_rea.model_res_partner
msgid "Contact"
msgstr ""

#. module: l10n_it_rea
#: selection:res.partner,rea_liquidation_state:0
msgid "In liquidation"
msgstr ""

#. module: l10n_it_rea
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_company_rea_liquidation_state
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_partner_rea_liquidation_state
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_users_rea_liquidation_state
msgid "Liquidation State"
msgstr ""

#. module: l10n_it_rea
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_company_rea_member_type
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_partner_rea_member_type
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_users_rea_member_type
msgid "Member Type"
Expand All @@ -47,17 +66,14 @@ msgid "Not in liquidation"
msgstr ""

#. module: l10n_it_rea
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_company_rea_office
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_partner_rea_office
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_users_rea_office
msgid "Office Province"
msgstr ""

#. module: l10n_it_rea
#: model:ir.model,name:l10n_it_rea.model_res_partner
msgid "Partner"
msgstr ""

#. module: l10n_it_rea
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_company_rea_code
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_partner_rea_code
#: model:ir.model.fields,field_description:l10n_it_rea.field_res_users_rea_code
msgid "REA Code"
Expand All @@ -68,6 +84,11 @@ msgstr ""
msgid "REA Registration"
msgstr ""

#. module: l10n_it_rea
#: model:ir.ui.view,arch_db:l10n_it_rea.view_company_form_rea
msgid "REA data"
msgstr ""

#. module: l10n_it_rea
#: sql_constraint:res.partner:0
msgid "The rea code code must be unique per company !"
Expand Down
1 change: 1 addition & 0 deletions l10n_it_rea/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from . import res_partner
from . import res_company
54 changes: 54 additions & 0 deletions l10n_it_rea/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models, api, _
from odoo.tools.misc import formatLang


class Company(models.Model):
_inherit = 'res.company'

rea_office = fields.Many2one(
'res.country.state', string='Office Province',
related='partner_id.rea_office')
rea_code = fields.Char('REA Code', size=20, related='partner_id.rea_code')
rea_capital = fields.Float('Capital', related='partner_id.rea_capital')
rea_member_type = fields.Selection(
[('SU', 'Unique Member'),
('SM', 'Multiple Members')], 'Member Type',
related='partner_id.rea_member_type')
rea_liquidation_state = fields.Selection(
[('LS', 'In liquidation'),
('LN', 'Not in liquidation')], 'Liquidation State',
related='partner_id.rea_liquidation_state')

@api.onchange(
"rea_office", "rea_code", "rea_capital", "rea_member_type",
"rea_liquidation_state"
)
def onchange_rea_data(self):
self.company_registry = ''
rea_member_type = ''
if (
self.rea_office or self.rea_code or self.rea_capital or
self.rea_member_type or self.rea_liquidation_state
):
if self.rea_member_type:
rea_member_type = dict(
self.env['res.partner']._fields[
'rea_member_type'
]._description_selection(self.env)
)[self.rea_member_type]
rea_liquidation_state = ''
if self.rea_liquidation_state:
rea_liquidation_state = dict(
self.env['res.partner']._fields[
'rea_liquidation_state'
]._description_selection(self.env)
)[self.rea_liquidation_state]
# using always €, as this is a registry of Italian companies
company_registry = _("%s %s Share Cap. %s € %s %s") % (
self.rea_office.code or '', self.rea_code or '',
formatLang(self.env, self.rea_capital), rea_member_type,
rea_liquidation_state
)
self.company_registry = company_registry
6 changes: 3 additions & 3 deletions l10n_it_rea/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
* Alessio Gerace <[email protected]>
* Alessio Gerace
* Nicola Malcontenti <[email protected]>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Andrea Gallina <[email protected]>
* Lorenzo Battistini <https://github.com/eLBati>
* Andrea Gallina
* Sergio Zanchetta <[email protected]>
7 changes: 7 additions & 0 deletions l10n_it_rea/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
**Italiano**

Questo modulo aggiunge al partner i campi relativi ai dati REA (Repertorio Economico Amministrativo).

http://www.registroimprese.it/codice-fiscale-p.iva-rea

I campi vengono aggiunti nella sezione contabile della scheda del partner, dove è possibile inserire i dati del Registro Imprese.

I dati REA sono anche disponibili nella scheda dell'azienda. Valorizzandoli, il campo 'registro imprese' verrà calcolato di conseguenza.

**English**

This module implement fields of REA data in partner.

http://www.registroimprese.it/codice-fiscale-p.iva-rea

Fields are added on accounting page of partner form, where you can
add data of business register.

REA fields are also available in company form and, filling them, Company Registry will be computed accordingly.
20 changes: 11 additions & 9 deletions l10n_it_rea/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,16 @@ <h1 class="title">Italian localization - Registro REA</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/l10n-italy/tree/11.0/l10n_it_rea"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-11-0/l10n-italy-11-0-l10n_it_rea"><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/122/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><strong>Italiano</strong></p>
<p>Questo modulo aggiunge al partner i campi relativi ai dati REA (Repertorio Economico Amministrativo).
<a class="reference external" href="http://www.registroimprese.it/codice-fiscale-p.iva-rea">http://www.registroimprese.it/codice-fiscale-p.iva-rea</a>
I campi vengono aggiunti nella sezione contabile della scheda del partner, dove è possibile inserire i dati del Registro Imprese.</p>
<p>Questo modulo aggiunge al partner i campi relativi ai dati REA (Repertorio Economico Amministrativo).</p>
<p><a class="reference external" href="http://www.registroimprese.it/codice-fiscale-p.iva-rea">http://www.registroimprese.it/codice-fiscale-p.iva-rea</a></p>
<p>I campi vengono aggiunti nella sezione contabile della scheda del partner, dove è possibile inserire i dati del Registro Imprese.</p>
<p>I dati REA sono anche disponibili nella scheda dell’azienda. Valorizzandoli, il campo ‘registro imprese’ verrà calcolato di conseguenza.</p>
<p><strong>English</strong></p>
<p>This module implement fields of REA data in partner.
<a class="reference external" href="http://www.registroimprese.it/codice-fiscale-p.iva-rea">http://www.registroimprese.it/codice-fiscale-p.iva-rea</a>
Fields are added on accounting page of partner form, where you can
<p>This module implement fields of REA data in partner.</p>
<p><a class="reference external" href="http://www.registroimprese.it/codice-fiscale-p.iva-rea">http://www.registroimprese.it/codice-fiscale-p.iva-rea</a></p>
<p>Fields are added on accounting page of partner form, where you can
add data of business register.</p>
<p>REA fields are also available in company form and, filling them, Company Registry will be computed accordingly.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand Down Expand Up @@ -409,10 +411,10 @@ <h2><a class="toc-backref" href="#id3">Authors</a></h2>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Alessio Gerace &lt;<a class="reference external" href="mailto:alessio.gerace&#64;agilebg.com">alessio.gerace&#64;agilebg.com</a>&gt;</li>
<li>Alessio Gerace</li>
<li>Nicola Malcontenti &lt;<a class="reference external" href="mailto:nicola.malcontenti&#64;agilebg.com">nicola.malcontenti&#64;agilebg.com</a>&gt;</li>
<li>Lorenzo Battistini &lt;<a class="reference external" href="mailto:lorenzo.battistini&#64;agilebg.com">lorenzo.battistini&#64;agilebg.com</a>&gt;</li>
<li>Andrea Gallina &lt;<a class="reference external" href="mailto:a.gallina&#64;apuliasoftware.it">a.gallina&#64;apuliasoftware.it</a>&gt;</li>
<li>Lorenzo Battistini &lt;<a class="reference external" href="https://github.com/eLBati">https://github.com/eLBati</a>&gt;</li>
<li>Andrea Gallina</li>
<li>Sergio Zanchetta &lt;<a class="reference external" href="mailto:primes2h&#64;gmail.com">primes2h&#64;gmail.com</a>&gt;</li>
</ul>
</div>
Expand Down
25 changes: 25 additions & 0 deletions l10n_it_rea/views/company_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record model="ir.ui.view" id="view_company_form_rea">
<field name="name">view_company_form_rea</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="REA data">
<group>
<field name="rea_office" />
<field name="rea_code" />
<field name="rea_capital" />
<field name="rea_member_type" />
<field name="rea_liquidation_state"/>
<field name="company_registry"/>
</group>
</page>
</notebook>
<field name="company_registry" position="replace"/>
</field>
</record>

</odoo>
4 changes: 2 additions & 2 deletions l10n_it_rea/views/partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<group name="accounting_entries" position="after">
<group string="REA Registration">
<field name="rea_office" />
<field name="rea_capital" />
<field name="rea_liquidation_state"/>
<field name="rea_code" />
<field name="rea_capital" />
<field name="rea_member_type" />
<field name="rea_liquidation_state"/>
</group>
</group>
</field>
Expand Down

0 comments on commit c082e7e

Please sign in to comment.