From 9df2b6dc5ac004cc25347821826ef802e3039672 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/README.rst | 8 ++++++++ account_analytic_organization/__manifest__.py | 3 ++- 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 | 5 ++++- .../models/account_move_line.py | 2 +- .../models/res_partner.py | 20 +++++++++++++++++-- .../static/description/index.html | 2 ++ .../views/account_analytic_organization.xml | 3 ++- 11 files changed, 64 insertions(+), 21 deletions(-) diff --git a/account_analytic_organization/README.rst b/account_analytic_organization/README.rst index 685c0c2b74..561f12e0c5 100644 --- a/account_analytic_organization/README.rst +++ b/account_analytic_organization/README.rst @@ -85,6 +85,14 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. +.. |maintainer-mpascuall| image:: https://github.com/mpascuall.png?size=40px + :target: https://github.com/mpascuall + :alt: mpascuall + +Current `maintainer `__: + +|maintainer-mpascuall| + This module is part of the `OCA/account-analytic `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_analytic_organization/__manifest__.py b/account_analytic_organization/__manifest__.py index 273892a23e..bcce18dcd6 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", @@ -17,4 +17,5 @@ "views/account_analytic_organization.xml", ], "installable": True, + "maintainers": ["mpascuall"], } 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..25c58e5135 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,6 @@ class AccountAnalyticOrganization(models.Model): _description = "Account Analytic Organization" name = fields.Char(required=True) + company_id = fields.Many2one( + "res.company", string="Company", default=lambda self: self.env.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..f8edbac239 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 @@ -8,5 +8,21 @@ class ResPartner(models.Model): _inherit = "res.partner" analytic_org_id = fields.Many2one( - "account.analytic.organization", string="Analytic Organization" + "account.analytic.organization", + string="Analytic Organization", + domain=lambda self: [("company_id", "=", self.env.company.id)], ) + + def name_get(self): + result = super(ResPartner, self).name_get() + updated_result = [] + + for partner_id, name in result: + partner = self.browse(partner_id) + if partner.analytic_org_id: + name = f"{partner.name} ({partner.analytic_org_id.name})" + else: + name = partner.name or "" + updated_result.append((partner_id, name)) + + return updated_result diff --git a/account_analytic_organization/static/description/index.html b/account_analytic_organization/static/description/index.html index a776ce404e..06df940fd7 100644 --- a/account_analytic_organization/static/description/index.html +++ b/account_analytic_organization/static/description/index.html @@ -429,6 +429,8 @@

Maintainers

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

+

Current maintainer:

+

mpascuall

This module is part of the OCA/account-analytic project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

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 - + +