Skip to content

Commit

Permalink
[IMP] l10n_fr_siret_lookup: add check for active companies
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-filament committed Jan 6, 2025
1 parent c58c0a9 commit 25c06f4
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 55 deletions.
2 changes: 1 addition & 1 deletion l10n_fr_siret_lookup/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ To update an existing parter, go to the partner form view and click on *Action >

By default, the search field is filled with Company name. To get more accurate results, you may want to add the City name where the company is registered. Then click on *Lookup*.

A list of company is displayed. You may want to click on one in order to see corresponding information or directly selecting company from tree view. Once a company is selected, the partner information is updated and a message is logged in the chatter.
A list of companies is displayed. You may want to click on one in order to see corresponding information or directly select company from tree view. Once a company is selected, the partner information is updated and a message is logged in the chatter.

Bug Tracker
===========
Expand Down
10 changes: 10 additions & 0 deletions l10n_fr_siret_lookup/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ msgstr "Código APE"
msgid "APE Label"
msgstr "Etiqueta APE"

#. module: l10n_fr_siret_lookup
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup_line__active
msgid "Active"
msgstr "Abierta"

#. module: l10n_fr_siret_lookup
#: model_terms:ir.ui.view,arch_db:l10n_fr_siret_lookup.fr_siret_lookup_line_form
msgid "Address"
Expand All @@ -51,6 +56,11 @@ msgstr "Ciudad"
msgid "Close"
msgstr "Cerrar"

#. module: l10n_fr_siret_lookup
#: model_terms:ir.ui.view,arch_db:l10n_fr_siret_lookup.fr_siret_lookup_line_form
msgid "Closed"
msgstr "Cerrada"

#. module: l10n_fr_siret_lookup
#: model_terms:ir.ui.view,arch_db:l10n_fr_siret_lookup.fr_siret_lookup_line_form
msgid "Company"
Expand Down
52 changes: 21 additions & 31 deletions l10n_fr_siret_lookup/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_fr_siren_lookup
# * l10n_fr_siret_lookup
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-12-04 14:28+0000\n"
"PO-Revision-Date: 2022-09-15 22:07+0000\n"
"Last-Translator: Claude R Perrin <[email protected]>\n"
"POT-Creation-Date: 2025-01-06 10:09+0000\n"
"PO-Revision-Date: 2025-01-06 10:09+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"
"Plural-Forms: \n"

#. module: l10n_fr_siret_lookup
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup_line__staff
Expand All @@ -32,6 +30,11 @@ msgstr "Code NAF"
msgid "APE Label"
msgstr "Libellé NAF"

#. module: l10n_fr_siret_lookup
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup_line__active
msgid "Active"
msgstr ""

#. module: l10n_fr_siret_lookup
#: model_terms:ir.ui.view,arch_db:l10n_fr_siret_lookup.fr_siret_lookup_line_form
msgid "Address"
Expand All @@ -52,6 +55,11 @@ msgstr "Ville"
msgid "Close"
msgstr "Fermer"

#. module: l10n_fr_siret_lookup
#: model_terms:ir.ui.view,arch_db:l10n_fr_siret_lookup.fr_siret_lookup_line_form
msgid "Closed"
msgstr "Fermée"

#. module: l10n_fr_siret_lookup
#: model_terms:ir.ui.view,arch_db:l10n_fr_siret_lookup.fr_siret_lookup_line_form
msgid "Company"
Expand All @@ -76,7 +84,7 @@ msgstr "Valider l'entreprise sélectionnée ?"
#. module: l10n_fr_siret_lookup
#: model:ir.model,name:l10n_fr_siret_lookup.model_res_partner
msgid "Contact"
msgstr "Contact"
msgstr ""

#. module: l10n_fr_siret_lookup
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup_line__country_id
Expand All @@ -98,7 +106,7 @@ msgstr "Créé le"
#. module: l10n_fr_siret_lookup
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup_line__creation_date
msgid "Creation Date"
msgstr ""
msgstr "Date de création"

#. module: l10n_fr_siret_lookup
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup__display_name
Expand Down Expand Up @@ -137,7 +145,7 @@ msgstr "Obtenir les informations sur les entreprises"
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup__id
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup_line__id
msgid "ID"
msgstr "ID"
msgstr ""

#. module: l10n_fr_siret_lookup
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup____last_update
Expand Down Expand Up @@ -210,7 +218,7 @@ msgstr "Résultats"
#. module: l10n_fr_siret_lookup
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup_line__siren
msgid "SIREN"
msgstr "SIREN"
msgstr ""

#. module: l10n_fr_siret_lookup
#: model:ir.actions.act_window,name:l10n_fr_siret_lookup.fr_siret_lookup_partner_action
Expand All @@ -230,7 +238,7 @@ msgstr "Recherche SIREN via opendatasoft.com"
#. module: l10n_fr_siret_lookup
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup_line__siret
msgid "SIRET"
msgstr "SIRET"
msgstr ""

#. module: l10n_fr_siret_lookup
#: model_terms:ir.ui.view,arch_db:l10n_fr_siret_lookup.fr_siret_lookup_form
Expand Down Expand Up @@ -264,21 +272,3 @@ msgstr "Assistant"
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup_line__zip
msgid "Zip"
msgstr "Code Postal"

#~ msgid "Creation date"
#~ msgstr "Date de création"

#~ msgid "CP"
#~ msgstr "CP"

#~ msgid "Companies Selection"
#~ msgstr "Sélection d'Entreprises"

#~ msgid "Informations base Siren"
#~ msgstr "Informations base Siren"

#~ msgid "Lookup Company"
#~ msgstr "Rechercher une Entreprise"

#~ msgid "Pre-Fill / Update"
#~ msgstr "Pré-Remplir / Mettre à jour"
12 changes: 12 additions & 0 deletions l10n_fr_siret_lookup/i18n/l10n_fr_siret_lookup.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-06 10:08+0000\n"
"PO-Revision-Date: 2025-01-06 10:08+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -28,6 +30,11 @@ msgstr ""
msgid "APE Label"
msgstr ""

#. module: l10n_fr_siret_lookup
#: model:ir.model.fields,field_description:l10n_fr_siret_lookup.field_fr_siret_lookup_line__active
msgid "Active"
msgstr ""

#. module: l10n_fr_siret_lookup
#: model_terms:ir.ui.view,arch_db:l10n_fr_siret_lookup.fr_siret_lookup_line_form
msgid "Address"
Expand All @@ -48,6 +55,11 @@ msgstr ""
msgid "Close"
msgstr ""

#. module: l10n_fr_siret_lookup
#: model_terms:ir.ui.view,arch_db:l10n_fr_siret_lookup.fr_siret_lookup_line_form
msgid "Closed"
msgstr ""

#. module: l10n_fr_siret_lookup
#: model_terms:ir.ui.view,arch_db:l10n_fr_siret_lookup.fr_siret_lookup_line_form
msgid "Company"
Expand Down
1 change: 1 addition & 0 deletions l10n_fr_siret_lookup/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def _opendatasoft_fields_list(self):
"divisionunitelegale",
"naturejuridiqueunitelegale",
"trancheeffectifsunitelegale",
"etatadministratifetablissement",
]

@api.model
Expand Down
2 changes: 1 addition & 1 deletion l10n_fr_siret_lookup/readme/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ To update an existing parter, go to the partner form view and click on *Action >

By default, the search field is filled with Company name. To get more accurate results, you may want to add the City name where the company is registered. Then click on *Lookup*.

A list of company is displayed. You may want to click on one in order to see corresponding information or directly selecting company from tree view. Once a company is selected, the partner information is updated and a message is logged in the chatter.
A list of companies is displayed. You may want to click on one in order to see corresponding information or directly select company from tree view. Once a company is selected, the partner information is updated and a message is logged in the chatter.
2 changes: 1 addition & 1 deletion l10n_fr_siret_lookup/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To update an existing parter, go to the partner form view and click on <em>Action &gt; SIREN Lookup</em>.</p>
<p>By default, the search field is filled with Company name. To get more accurate results, you may want to add the City name where the company is registered. Then click on <em>Lookup</em>.</p>
<p>A list of company is displayed. You may want to click on one in order to see corresponding information or directly selecting company from tree view. Once a company is selected, the partner information is updated and a message is logged in the chatter.</p>
<p>A list of companies is displayed. You may want to click on one in order to see corresponding information or directly select company from tree view. Once a company is selected, the partner information is updated and a message is logged in the chatter.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
Expand Down
6 changes: 5 additions & 1 deletion l10n_fr_siret_lookup/wizard/fr_siret_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def _prepare_partner_from_data(self, data):
"ape_label": data.get("divisionunitelegale"),
"legal_type": data.get("naturejuridiqueunitelegale"),
"staff": data.get("trancheeffectifsunitelegale", 0),
"active": data.get("etatadministratifetablissement") == "Actif",
}

def get_lines(self):
Expand All @@ -78,8 +79,10 @@ def get_lines(self):
res = self._prepare_partner_from_data(company["fields"])
companies_vals.append((0, 0, res))
self.line_ids = companies_vals
current_context = dict(self.env.context)
current_context["active_test"] = False

Check warning on line 83 in l10n_fr_siret_lookup/wizard/fr_siret_lookup.py

View check run for this annotation

Codecov / codecov/patch

l10n_fr_siret_lookup/wizard/fr_siret_lookup.py#L82-L83

Added lines #L82 - L83 were not covered by tests
return {
"context": self.env.context,
"context": current_context,
"view_mode": "form",
"res_model": self._name,
"res_id": self.id,
Expand Down Expand Up @@ -107,6 +110,7 @@ class FrSiretLookupLine(models.TransientModel):
creation_date = fields.Date()
staff = fields.Char("# Staff")
category = fields.Char()
active = fields.Boolean()

def _prepare_partner_values(self):
self.ensure_one()
Expand Down
51 changes: 31 additions & 20 deletions l10n_fr_siret_lookup/wizard/fr_siret_lookup_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,33 @@
type="object"
colspan="2"
/>
</group><group string="Search Results" name="lines">
<field name="line_ids" nolabel="1" colspan="2">
<tree>
<field name="name" />
<field name="street" optional="show" />
<field name="zip" optional="show" />
<field name="city" optional="show" />
<field name="country_id" optional="hide" />
<field name="legal_type" optional="show" />
<field name="siren" optional="hide" />
<field name="siret" optional="hide" />
<field name="ape" optional="hide" />
<field name="ape_label" optional="hide" />
<field name="category" optional="hide" />
<field name="creation_date" optional="hide" />
<field name="staff" optional="hide" />
<button
</group>
<group string="Search Results" name="lines">
<field name="line_ids" nolabel="1" colspan="2">
<tree decoration-muted="not active">
<field name="name" />
<field name="street" optional="show" />
<field name="zip" optional="show" />
<field name="city" optional="show" />
<field name="country_id" optional="hide" />
<field name="legal_type" optional="show" />
<field name="active" optional="show" />
<field name="siren" optional="hide" />
<field name="siret" optional="hide" />
<field name="ape" optional="hide" />
<field name="ape_label" optional="hide" />
<field name="category" optional="hide" />
<field name="creation_date" optional="hide" />
<field name="staff" optional="hide" />
<button
class="btn-primary"
name="update_partner"
string="Select"
type="object"
confirm="Confirm selected company ?"
/>
</tree>
</field>
</tree>
</field>
</group>
<footer>
<button special="cancel" string="Close" />
Expand All @@ -53,7 +55,16 @@
<field name="model">fr.siret.lookup.line</field>
<field name="arch" type="xml">
<form string="Company">
<h3><field name="name" /></h3>
<field name="active" invisible="1" />
<widget
name="web_ribbon"
title="Closed"
bg_color="text-bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<h3>
<field name="name" />
</h3>
<group>
<group string="Address">
<field name="street" />
Expand Down

0 comments on commit 25c06f4

Please sign in to comment.