[IMP] base_usability: improve report header methods on res.company

This commit is contained in:
Alexis de Lattre
2024-03-27 11:17:26 +01:00
parent 5532a8e165
commit b019baed6e
3 changed files with 102 additions and 30 deletions

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-07 22:00+0000\n"
"PO-Revision-Date: 2024-02-07 22:00+0000\n"
"POT-Creation-Date: 2024-03-27 10:15+0000\n"
"PO-Revision-Date: 2024-03-27 10:15+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -15,6 +15,13 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: base_usability
#. odoo-python
#: code:addons/base_usability/models/res_company.py:0
#, python-format
msgid "%s with a capital of"
msgstr ""
#. module: base_usability
#. odoo-python
#: code:addons/base_usability/models/res_company.py:0
@@ -32,6 +39,13 @@ msgstr ""
msgid "Bank Name"
msgstr ""
#. module: base_usability
#. odoo-python
#: code:addons/base_usability/models/res_company.py:0
#, python-format
msgid "Capital:"
msgstr ""
#. module: base_usability
#: model:ir.model,name:base_usability.model_res_company
msgid "Companies"
@@ -134,6 +148,13 @@ msgstr ""
msgid "Reference"
msgstr ""
#. module: base_usability
#. odoo-python
#: code:addons/base_usability/models/res_company.py:0
#, python-format
msgid "SIREN:"
msgstr ""
#. module: base_usability
#. odoo-python
#: code:addons/base_usability/models/res_company.py:0

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-07 21:56+0000\n"
"PO-Revision-Date: 2024-02-07 21:56+0000\n"
"POT-Creation-Date: 2024-03-27 10:15+0000\n"
"PO-Revision-Date: 2024-03-27 10:15+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -15,6 +15,13 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: base_usability
#. odoo-python
#: code:addons/base_usability/models/res_company.py:0
#, python-format
msgid "%s with a capital of"
msgstr "%s au capital de"
#. module: base_usability
#. odoo-python
#: code:addons/base_usability/models/res_company.py:0
@@ -32,6 +39,13 @@ msgstr "Comptes bancaires"
msgid "Bank Name"
msgstr "Nom de la banque"
#. module: base_usability
#. odoo-python
#: code:addons/base_usability/models/res_company.py:0
#, python-format
msgid "Capital:"
msgstr "Capital :"
#. module: base_usability
#: model:ir.model,name:base_usability.model_res_company
msgid "Companies"
@@ -78,7 +92,7 @@ msgstr "EORI :"
#. module: base_usability
#: model_terms:ir.ui.view,arch_db:base_usability.ir_property_view_search
msgid "Field"
msgstr ""
msgstr "Champ"
#. module: base_usability
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
@@ -105,7 +119,7 @@ msgstr "Portable :"
#. module: base_usability
#: model:ir.model,name:base_usability.model_ir_model
msgid "Models"
msgstr "Modèles"
msgstr ""
#. module: base_usability
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
@@ -115,7 +129,7 @@ msgstr "Nom ou code"
#. module: base_usability
#: model_terms:ir.ui.view,arch_db:base_usability.view_res_partner_filter
msgid "Name or Email or VAT or Reference"
msgstr "Nom ou e-mail ou TVA ou référence"
msgstr "Nom ou e-mail ou TVA ou référence"
#. module: base_usability
#: model:ir.model.fields,field_description:base_usability.field_res_partner__name_title
@@ -134,6 +148,13 @@ msgstr "Personne (utilisé pour cacher des entrées de menu natifs)"
msgid "Reference"
msgstr "Référence"
#. module: base_usability
#. odoo-python
#: code:addons/base_usability/models/res_company.py:0
#, python-format
msgid "SIREN:"
msgstr "SIREN :"
#. module: base_usability
#. odoo-python
#: code:addons/base_usability/models/res_company.py:0
@@ -160,7 +181,7 @@ msgstr "Tél :"
#. module: base_usability
#: model:ir.model,name:base_usability.model_res_users
msgid "User"
msgstr "Utilisateur"
msgstr ""
#. module: base_usability
#. odoo-python

View File

@@ -3,6 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models, _
from odoo.tools.misc import format_amount
class ResCompany(models.Model):
@@ -39,48 +40,77 @@ class ResCompany(models.Model):
'value': self.phone,
# http://www.fileformat.info/info/unicode/char/1f4de/index.htm
'icon': '\U0001F4DE',
'label': _('Tel:')},
'label': _('Tel:'),
},
'email': {
'value': self.email,
# http://www.fileformat.info/info/unicode/char/2709/index.htm
'icon': '\u2709',
'label': _('E-mail:')},
'label': _('E-mail:'),
},
'website': {
'value': self.website,
'icon': '\U0001f310',
'label': _('Website:')},
'label': _('Website:'),
},
'vat': {
'value': self.vat,
'label': _('VAT:')},
}
if hasattr(self, 'ape'):
options['ape'] = {
'value': self.ape,
'label': _('VAT:'),
},
'ape': {
'value': hasattr(self, 'ape') and self.ape or False,
'label': _('APE:'),
}
if hasattr(self, 'siret'):
options.update({
'siret': {
'value': self.siret,
'label': _('SIRET:'),
},
'eori': {
'value': ''.join([self.country_id.code, self.siret]),
'label': _('EORI:'),
},
})
},
'siret': {
'value': hasattr(self, 'siret') and self.siret or False,
'label': _('SIRET:'),
},
'siren': {
'value': hasattr(self, 'siren') and self.siren or False,
'label': _('SIREN:'),
},
'eori': {
'value': self._get_eori(),
'label': _('EORI:'),
},
'capital': {
# 'capital_amount' added by base_company_extension
'value': hasattr(self, 'capital_amount') and self.capital_amount and format_amount(self.env, self.capital_amount, self.currency_id) or False,
'label': _('Capital:'),
},
}
# 'legal_type' added by base_company_extension
if hasattr(self, 'legal_type') and self.legal_type:
options['capital']['label'] = _('%s with a capital of') % self.legal_type
return options
def _get_eori(self):
eori = False
if self.partner_id.country_id.code == 'FR' and hasattr(self, 'siret') and self.siret:
# Currently migrating from EORI-SIRET to EORI-SIREN :
# https://www.pwcavocats.com/fr/ealertes/ealertes-france/2023/avril/reforme-numero-eori-siren-siret.html
# But, for the moment, we continue to use EORI-SIRET
eori = f'FR{self.siret}'
return eori
def _report_company_legal_name(self):
'''Method inherited in the module base_company_extension'''
self.ensure_one()
return self.name
def _report_header_line_details(self):
"""This method is designed to be inherited"""
# I decided not to put email in the default header because only a few very small
# companies have a generic company email address
line_details = [['phone', 'website', 'capital'], ['vat', 'siret', 'eori', 'ape']]
return line_details
# for reports
def _display_report_header(
self, line_details=[['phone', 'website'], ['vat']],
icon=True, line_separator=' - '):
self, line_details=None, icon=True, line_separator=' - '):
self.ensure_one()
if line_details is None:
line_details = self._report_header_line_details()
res = ''
address = self.partner_id._display_address(without_company=True)
address = address.replace('\n', ' - ')