From da75895c700af64e7a3aaf1825c8a35758dd27d9 Mon Sep 17 00:00:00 2001 From: mpascual Date: Mon, 7 Oct 2024 12:46:23 +0200 Subject: [PATCH] [16.0][IMP] account_analytic_organization: Added company_id field, fixed spanish translation and made organization name appear in partner name --- account_analytic_organization/__manifest__.py | 2 +- account_analytic_organization/i18n/ca_ES.po | 18 +++++++++++------ account_analytic_organization/i18n/es.po | 20 ++++++++++++------- .../models/__init__.py | 2 +- .../models/account_analytic_line.py | 2 +- .../models/account_analytic_organization.py | 3 ++- .../models/account_move_line.py | 2 +- .../models/res_partner.py | 8 +++++++- .../views/account_analytic_organization.xml | 3 ++- 9 files changed, 40 insertions(+), 20 deletions(-) diff --git a/account_analytic_organization/__manifest__.py b/account_analytic_organization/__manifest__.py index 273892a23e..999ea8d2be 100644 --- a/account_analytic_organization/__manifest__.py +++ b/account_analytic_organization/__manifest__.py @@ -1,4 +1,4 @@ -# Copyright 2023 APSL - Nagarro +# Copyright 2024 APSL - Nagarro # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Account Analytic Organization", diff --git a/account_analytic_organization/i18n/ca_ES.po b/account_analytic_organization/i18n/ca_ES.po index 9888a1aa0e..92329bddb0 100644 --- a/account_analytic_organization/i18n/ca_ES.po +++ b/account_analytic_organization/i18n/ca_ES.po @@ -6,11 +6,10 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 11:09+0000\n" -"PO-Revision-Date: 2024-09-18 11:09+0000\n" +"POT-Creation-Date: 2024-10-07 10:40+0000\n" +"PO-Revision-Date: 2024-10-07 10:40+0000\n" "Last-Translator: \n" "Language-Team: \n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -20,7 +19,7 @@ msgstr "" #: model:ir.actions.act_window,name:account_analytic_organization.account_analytic_organization_action #: model:ir.model,name:account_analytic_organization.model_account_analytic_organization msgid "Account Analytic Organization" -msgstr "" +msgstr "Organització Analítica" #. module: account_analytic_organization #: model:ir.model,name:account_analytic_organization.model_account_analytic_line @@ -38,6 +37,11 @@ msgstr "Línia analítica" msgid "Analytic Organization" msgstr "Organització Analítica" +#. module: account_analytic_organization +#: model:ir.model.fields,field_description:account_analytic_organization.field_account_analytic_organization__company_id +msgid "Company" +msgstr "Empresa" + #. module: account_analytic_organization #: model:ir.model,name:account_analytic_organization.model_res_partner msgid "Contact" @@ -88,5 +92,7 @@ msgstr "Darrera Actualització el" msgid "Name" msgstr "Nom" -#~ msgid "Old" -#~ msgstr "Antic" +#. module: account_analytic_organization +#: model:ir.model.fields,field_description:account_analytic_organization.field_account_analytic_organization__old_id +msgid "Old" +msgstr "Antiga" diff --git a/account_analytic_organization/i18n/es.po b/account_analytic_organization/i18n/es.po index 0a98d25da3..ac36b3767f 100644 --- a/account_analytic_organization/i18n/es.po +++ b/account_analytic_organization/i18n/es.po @@ -6,11 +6,10 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 11:11+0000\n" -"PO-Revision-Date: 2024-09-18 11:11+0000\n" +"POT-Creation-Date: 2024-10-07 10:41+0000\n" +"PO-Revision-Date: 2024-10-07 10:41+0000\n" "Last-Translator: \n" "Language-Team: \n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -20,7 +19,7 @@ msgstr "" #: model:ir.actions.act_window,name:account_analytic_organization.account_analytic_organization_action #: model:ir.model,name:account_analytic_organization.model_account_analytic_organization msgid "Account Analytic Organization" -msgstr "" +msgstr "Organización Analítica" #. module: account_analytic_organization #: model:ir.model,name:account_analytic_organization.model_account_analytic_line @@ -36,7 +35,12 @@ msgstr "Línea analítica" #: model_terms:ir.ui.view,arch_db:account_analytic_organization.view_account_analytic_line_search_inherit #: model_terms:ir.ui.view,arch_db:account_analytic_organization.view_account_move_line_search_inherit msgid "Analytic Organization" -msgstr "Organitzación Analítica" +msgstr "Organización Analítica" + +#. module: account_analytic_organization +#: model:ir.model.fields,field_description:account_analytic_organization.field_account_analytic_organization__company_id +msgid "Company" +msgstr "Empresa" #. module: account_analytic_organization #: model:ir.model,name:account_analytic_organization.model_res_partner @@ -88,5 +92,7 @@ msgstr "Última Actualización el" msgid "Name" msgstr "Nombre" -#~ msgid "Old" -#~ msgstr "Antiguo" +#. module: account_analytic_organization +#: model:ir.model.fields,field_description:account_analytic_organization.field_account_analytic_organization__old_id +msgid "Old" +msgstr "Antigua" diff --git a/account_analytic_organization/models/__init__.py b/account_analytic_organization/models/__init__.py index dd66a7f755..077ccf965f 100644 --- a/account_analytic_organization/models/__init__.py +++ b/account_analytic_organization/models/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2023 APSL - Nagarro +# Copyright 2024 APSL - Nagarro # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import res_partner diff --git a/account_analytic_organization/models/account_analytic_line.py b/account_analytic_organization/models/account_analytic_line.py index 336450c88d..1808d25e00 100644 --- a/account_analytic_organization/models/account_analytic_line.py +++ b/account_analytic_organization/models/account_analytic_line.py @@ -1,4 +1,4 @@ -# Copyright 2023 APSL - Nagarro +# Copyright 2024 APSL - Nagarro # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import fields, models diff --git a/account_analytic_organization/models/account_analytic_organization.py b/account_analytic_organization/models/account_analytic_organization.py index 68eaf4f598..b15f5b1ca1 100644 --- a/account_analytic_organization/models/account_analytic_organization.py +++ b/account_analytic_organization/models/account_analytic_organization.py @@ -1,4 +1,4 @@ -# Copyright 2023 APSL - Nagarro +# Copyright 2024 APSL - Nagarro # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import fields, models @@ -9,3 +9,4 @@ class AccountAnalyticOrganization(models.Model): _description = "Account Analytic Organization" name = fields.Char(required=True) + company_id = fields.Many2one("res.company", string="Company") diff --git a/account_analytic_organization/models/account_move_line.py b/account_analytic_organization/models/account_move_line.py index 2dd1569dd4..2f8e3a3c6a 100644 --- a/account_analytic_organization/models/account_move_line.py +++ b/account_analytic_organization/models/account_move_line.py @@ -1,4 +1,4 @@ -# Copyright 2023 APSL - Nagarro +# Copyright 2024 APSL - Nagarro # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import fields, models diff --git a/account_analytic_organization/models/res_partner.py b/account_analytic_organization/models/res_partner.py index 536fb2da53..a03589b219 100644 --- a/account_analytic_organization/models/res_partner.py +++ b/account_analytic_organization/models/res_partner.py @@ -1,4 +1,4 @@ -# Copyright 2023 APSL - Nagarro +# Copyright 2024 APSL - Nagarro # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import fields, models @@ -10,3 +10,9 @@ class ResPartner(models.Model): analytic_org_id = fields.Many2one( "account.analytic.organization", string="Analytic Organization" ) + + def _get_name(self): + name = super(ResPartner, self)._get_name() + if self.analytic_org_id: + name = f"{name} ({self.analytic_org_id.name})" + return name \ No newline at end of file diff --git a/account_analytic_organization/views/account_analytic_organization.xml b/account_analytic_organization/views/account_analytic_organization.xml index ad6e293a18..644de62c71 100644 --- a/account_analytic_organization/views/account_analytic_organization.xml +++ b/account_analytic_organization/views/account_analytic_organization.xml @@ -3,8 +3,9 @@ account.analytic.organization.tree account.analytic.organization - + +