diff --git a/crm_claim_extra_ref/README.rst b/crm_claim_extra_ref/README.rst new file mode 100644 index 00000000..e15a9ffb --- /dev/null +++ b/crm_claim_extra_ref/README.rst @@ -0,0 +1,44 @@ +=================== +CRM claim extra ref +=================== + +.. |badge1| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +|badge1| + +This module creates the new fields "Reference 2" and "Reference 3" and shows +then in the form, in the search search form, and allows grouping records by +these new fields. + + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* AvanzOSC + +Contributors +~~~~~~~~~~~~ + +* Pedro M. Baeza +* Ana Juaristi +* Alfredo de la Fuente diff --git a/crm_claim_extra_ref/__init__.py b/crm_claim_extra_ref/__init__.py new file mode 100644 index 00000000..9186ee3a --- /dev/null +++ b/crm_claim_extra_ref/__init__.py @@ -0,0 +1 @@ +from . import model diff --git a/crm_claim_extra_ref/__manifest__.py b/crm_claim_extra_ref/__manifest__.py new file mode 100644 index 00000000..799fbe02 --- /dev/null +++ b/crm_claim_extra_ref/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2015 Pedro M. Baeza (http://www.serviciosbaeza.com) +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# Copyright 2026 Eñaut Alberdi - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "CRM Claim Extra Ref", + "version": "18.0.1.0.0", + "author": "OdooMRP team," "AvanzOSC," "Serv. Tecnol. Avanzados - Pedro M. Baeza", + "category": "CRM Claim", + "license": "AGPL-3", + "website": "https://github.com/avanzosc/crm-addons", + "contributors": [ + "Pedro M. Baeza ", + "Alfredo de la Fuente ", + "Eñaut Alberdi ", + ], + "depends": ["crm_claim", "crm_claim_report"], + "data": [ + "reports/crm_claim_report.xml", + "views/crm_claim_view.xml", + ], + "installable": True, +} diff --git a/crm_claim_extra_ref/i18n/crm_claim_extra_ref.pot b/crm_claim_extra_ref/i18n/crm_claim_extra_ref.pot new file mode 100644 index 00000000..c6cb29c1 --- /dev/null +++ b/crm_claim_extra_ref/i18n/crm_claim_extra_ref.pot @@ -0,0 +1,67 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_claim_extra_ref +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-03-25 12:42+0000\n" +"PO-Revision-Date: 2024-03-25 12:42+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: crm_claim_extra_ref +#: model:ir.model,name:crm_claim_extra_ref.model_crm_claim +msgid "Claim" +msgstr "" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref_model_name2 +msgid "Ref. Model 2" +msgstr "" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref_model_name3 +msgid "Ref. Model 3" +msgstr "" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref_name2 +msgid "Ref. Name 2" +msgstr "" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref_name3 +msgid "Ref. Name 3" +msgstr "" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref2 +#: model_terms:ir.ui.view,arch_db:crm_claim_extra_ref.view_crm_case_claims_filter_inh_extraref +msgid "Reference 2" +msgstr "" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref3 +#: model_terms:ir.ui.view,arch_db:crm_claim_extra_ref.view_crm_case_claims_filter_inh_extraref +msgid "Reference 3" +msgstr "" + +#. module: crm_claim_extra_ref +#: model_terms:ir.ui.view,arch_db:crm_claim_extra_ref.report_crmclaim_document +msgid "" +"
\n" +" Reference 2:" +msgstr "" + +#. module: crm_claim_extra_ref +#: model_terms:ir.ui.view,arch_db:crm_claim_extra_ref.report_crmclaim_document +msgid "" +"
\n" +" Reference 3:" +msgstr "" diff --git a/crm_claim_extra_ref/i18n/es.po b/crm_claim_extra_ref/i18n/es.po new file mode 100644 index 00000000..ea2db9a3 --- /dev/null +++ b/crm_claim_extra_ref/i18n/es.po @@ -0,0 +1,71 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_claim_extra_ref +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-03-25 12:42+0000\n" +"PO-Revision-Date: 2024-03-25 12:42+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: crm_claim_extra_ref +#: model:ir.model,name:crm_claim_extra_ref.model_crm_claim +msgid "Claim" +msgstr "Reclamación" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref_model_name2 +msgid "Ref. Model 2" +msgstr "Ref. Modelo 2" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref_model_name3 +msgid "Ref. Model 3" +msgstr "Ref. Modelo 3" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref_name2 +msgid "Ref. Name 2" +msgstr "Ref. Nombre 2" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref_name3 +msgid "Ref. Name 3" +msgstr "Ref. Nombre 3" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref2 +#: model_terms:ir.ui.view,arch_db:crm_claim_extra_ref.view_crm_case_claims_filter_inh_extraref +msgid "Reference 2" +msgstr "Referencia 2" + +#. module: crm_claim_extra_ref +#: model:ir.model.fields,field_description:crm_claim_extra_ref.field_crm_claim__ref3 +#: model_terms:ir.ui.view,arch_db:crm_claim_extra_ref.view_crm_case_claims_filter_inh_extraref +msgid "Reference 3" +msgstr "Referencia 3" + +#. module: crm_claim_extra_ref +#: model_terms:ir.ui.view,arch_db:crm_claim_extra_ref.report_crmclaim_document +msgid "" +"
\n" +" Reference 2:" +msgstr "" +"
\n" +" Referencia 2:" + +#. module: crm_claim_extra_ref +#: model_terms:ir.ui.view,arch_db:crm_claim_extra_ref.report_crmclaim_document +msgid "" +"
\n" +" Reference 3:" +msgstr "" +"
\n" +" Referencia 3:" diff --git a/crm_claim_extra_ref/model/__init__.py b/crm_claim_extra_ref/model/__init__.py new file mode 100644 index 00000000..29fa1b4d --- /dev/null +++ b/crm_claim_extra_ref/model/__init__.py @@ -0,0 +1 @@ +from . import crm_claim diff --git a/crm_claim_extra_ref/model/crm_claim.py b/crm_claim_extra_ref/model/crm_claim.py new file mode 100644 index 00000000..48e23759 --- /dev/null +++ b/crm_claim_extra_ref/model/crm_claim.py @@ -0,0 +1,75 @@ +from odoo import _, api, fields, models + +APPLICABLE_MODELS = [ + "account.invoice", + "event.registration", + "hr.applicant", + "res.partner", + "product.product", + "purchase.order", + "purchase.order.line", + "sale.order", + "sale.order.line", +] + + +class CrmClaim(models.Model): + _inherit = "crm.claim" + + def _links_get(self): + return [ + (x, _(self.env[x]._description)) for x in APPLICABLE_MODELS if x in self.env + ] + + @api.depends("ref2") + def _compute_ref_model_name2(self): + model_obj = self.env["ir.model"] + for claim in self: + ref_model_name2 = False + if claim.ref2: + cond = [("model", "=", str(claim.ref2._name))] + model = model_obj.search(cond) + ref_model_name2 = model.display_name + claim.ref_model_name2 = ref_model_name2 + + @api.depends("ref2") + def _compute_ref_name2(self): + for claim in self: + ref_name2 = False + if claim.ref2: + ref_name2 = claim.ref2.display_name or claim.ref2.name + claim.ref_name2 = ref_name2 + + @api.depends("ref3") + def _compute_ref_model_name3(self): + model_obj = self.env["ir.model"] + for claim in self: + ref_model_name3 = False + if claim.ref3: + cond = [("model", "=", str(claim.ref3._name))] + model = model_obj.search(cond) + ref_model_name3 = model.display_name + claim.ref_model_name3 = ref_model_name3 + + @api.depends("ref3") + def _compute_ref_name3(self): + for claim in self: + ref_name3 = False + if claim.ref3: + ref_name3 = claim.ref3.display_name or claim.ref3.name + claim.ref_name3 = ref_name3 + + ref2 = fields.Reference(string="Reference 2", selection="_links_get") + ref_model_name2 = fields.Char( + string="Ref. Model 2", compute="_compute_ref_model_name2", store=True + ) + ref_name2 = fields.Char( + string="Ref. Name 2", compute="_compute_ref_name2", store=True + ) + ref3 = fields.Reference(string="Reference 3", selection="_links_get") + ref_model_name3 = fields.Char( + string="Ref. Model 3", compute="_compute_ref_model_name3", store=True + ) + ref_name3 = fields.Char( + string="Ref. Name 3", compute="_compute_ref_name3", store=True + ) diff --git a/crm_claim_extra_ref/pyproject.toml b/crm_claim_extra_ref/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/crm_claim_extra_ref/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/crm_claim_extra_ref/reports/crm_claim_report.xml b/crm_claim_extra_ref/reports/crm_claim_report.xml new file mode 100644 index 00000000..316501a6 --- /dev/null +++ b/crm_claim_extra_ref/reports/crm_claim_report.xml @@ -0,0 +1,20 @@ + + + + diff --git a/crm_claim_extra_ref/views/crm_claim_view.xml b/crm_claim_extra_ref/views/crm_claim_view.xml new file mode 100644 index 00000000..6a580d93 --- /dev/null +++ b/crm_claim_extra_ref/views/crm_claim_view.xml @@ -0,0 +1,54 @@ + + + + crm.claim + + + + + + + + + + + + + + + + crm.case.claims.tree.view.inh.extraref + crm.claim + + + + + + + + + + + crm.case.claims.form.view.inh.extraref + crm.claim + + + + + + + + +