diff --git a/mpf_crm/README.rst b/mpf_crm/README.rst new file mode 100644 index 0000000..d5a7697 --- /dev/null +++ b/mpf_crm/README.rst @@ -0,0 +1,35 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +======= +Mpf crm +======= + +* New objects: "Belongs to", "Brand", "Crm Lead Type", in CRM - Configuration - + Customizations. +* In crm lead object new fields: "Cancelled quotations", "Lead Type", "Brand", + "It belongs to". +* In account move object new fields: "Opportunity", "Lead Type" and "Brand". +* When an invoice is created from a sales order, the invoice will be informed + of the sales order opportunity. + +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 smash it by providing detailed and welcomed feedback. + +Do not contact contributors directly about support or help with technical issues. + + +Credits +======= + +Contributors +~~~~~~~~~~~~ + +* Ana Juaristi +* Alfredo de la Fuente diff --git a/mpf_crm/__init__.py b/mpf_crm/__init__.py new file mode 100644 index 0000000..4419bc5 --- /dev/null +++ b/mpf_crm/__init__.py @@ -0,0 +1,9 @@ +from . import models + + +def _post_install_put_sale_lead_in_account_invoice(env): + cond = [("opportunity_id", "!=", False)] + sales = env["sale.order"].search(cond) + for sale in sales: + if sale.invoice_ids: + sale.invoice_ids.write({"opportunity_id": sale.opportunity_id.id}) diff --git a/mpf_crm/__manifest__.py b/mpf_crm/__manifest__.py new file mode 100644 index 0000000..11f83c6 --- /dev/null +++ b/mpf_crm/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2026 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "MPF Crm", + "summary": "Personalizaciones Odoo para MP Fluids", + "version": "18.0.1.0.0", + "category": "Custom Module", + "license": "AGPL-3", + "author": "AvanzOSC", + "website": "https://github.com/avanzosc/custom-addons", + "depends": ["sale", "crm", "sale_crm", "sales_team", "account"], + "data": [ + "security/ir.model.access.csv", + "views/crm_lead_belong_views.xml", + "views/crm_lead_brand_views.xml", + "views/crm_lead_type_views.xml", + "views/crm_lead_views.xml", + "views/account_move_views.xml", + ], + "post_init_hook": "_post_install_put_sale_lead_in_account_invoice", +} diff --git a/mpf_crm/i18n/en_GB.po b/mpf_crm/i18n/en_GB.po new file mode 100644 index 0000000..36de9b4 --- /dev/null +++ b/mpf_crm/i18n/en_GB.po @@ -0,0 +1,181 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mpf_crm +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-01-08 11:57+0000\n" +"PO-Revision-Date: 2026-01-08 11:57+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: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__lead_ids +#: model:ir.model.fields,field_description:mpf_crm.field_brand__lead_ids +#: model:ir.model.fields,field_description:mpf_crm.field_type__lead_ids +msgid "Assigned leads" +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_belongs +msgid "Belongs to" +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_brand +#: model:ir.model.fields,field_description:mpf_crm.field_account_bank_statement_line__lead_brand_id +#: model:ir.model.fields,field_description:mpf_crm.field_account_move__lead_brand_id +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__brand_id +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_opportunity_report_view_search +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_account_invoice_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_opportunities_filter +msgid "Brand" +msgstr "" + +#. module: mpf_crm +#: model:ir.actions.act_window,name:mpf_crm.crm_lead_brand_action +#: model:ir.ui.menu,name:mpf_crm.menu_crm_lead_brand +msgid "Brands" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__cancelled_quotation_count +msgid "Cancelled quotations" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__create_uid +#: model:ir.model.fields,field_description:mpf_crm.field_brand__create_uid +#: model:ir.model.fields,field_description:mpf_crm.field_type__create_uid +msgid "Created by" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__create_date +#: model:ir.model.fields,field_description:mpf_crm.field_brand__create_date +#: model:ir.model.fields,field_description:mpf_crm.field_type__create_date +msgid "Created on" +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_type +msgid "Crm Lead Type" +msgstr "" + +#. module: mpf_crm +#: model:ir.ui.menu,name:mpf_crm.crm_custom_menu_config +msgid "Customizations" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__name +#: model:ir.model.fields,field_description:mpf_crm.field_brand__name +#: model:ir.model.fields,field_description:mpf_crm.field_type__name +msgid "Description" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__display_name +#: model:ir.model.fields,field_description:mpf_crm.field_brand__display_name +#: model:ir.model.fields,field_description:mpf_crm.field_type__display_name +msgid "Display Name" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__id +#: model:ir.model.fields,field_description:mpf_crm.field_brand__id +#: model:ir.model.fields,field_description:mpf_crm.field_type__id +msgid "ID" +msgstr "" + +#. module: mpf_crm +#: model:ir.actions.act_window,name:mpf_crm.crm_lead_belongs_action +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__belong_id +#: model:ir.ui.menu,name:mpf_crm.menu_crm_lead_belong +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_belongs_tree_view +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_opportunity_report_view_search +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_opportunities_filter +msgid "It belongs to" +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__write_uid +#: model:ir.model.fields,field_description:mpf_crm.field_brand__write_uid +#: model:ir.model.fields,field_description:mpf_crm.field_type__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__write_date +#: model:ir.model.fields,field_description:mpf_crm.field_brand__write_date +#: model:ir.model.fields,field_description:mpf_crm.field_type__write_date +msgid "Last Updated on" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__lead_type_id +msgid "Lead Type" +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_crm_lead +msgid "Lead/Opportunity" +msgstr "" + +#. module: mpf_crm +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_brand_tree_view +msgid "Master of brands" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_account_bank_statement_line__opportunity_id +#: model:ir.model.fields,field_description:mpf_crm.field_account_move__opportunity_id +msgid "Opportunity" +msgstr "" + +#. module: mpf_crm +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +msgid "Pres.cancel." +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_account_bank_statement_line__lead_type_id +#: model:ir.model.fields,field_description:mpf_crm.field_account_move__lead_type_id +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_opportunity_report_view_search +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_account_invoice_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_opportunities_filter +msgid "Type" +msgstr "" + +#. module: mpf_crm +#: model:ir.actions.act_window,name:mpf_crm.crm_lead_type_action +#: model:ir.ui.menu,name:mpf_crm.menu_crm_lead_type +msgid "Types" +msgstr "" + +#. module: mpf_crm +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_type_tree_view +msgid "Types (master)" +msgstr "" diff --git a/mpf_crm/i18n/es.po b/mpf_crm/i18n/es.po new file mode 100644 index 0000000..4b189a0 --- /dev/null +++ b/mpf_crm/i18n/es.po @@ -0,0 +1,181 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mpf_crm +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-01-08 11:58+0000\n" +"PO-Revision-Date: 2026-01-08 11:58+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: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__lead_ids +#: model:ir.model.fields,field_description:mpf_crm.field_brand__lead_ids +#: model:ir.model.fields,field_description:mpf_crm.field_type__lead_ids +msgid "Assigned leads" +msgstr "Leads Asignados" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_belongs +msgid "Belongs to" +msgstr "Pertenece a" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_brand +#: model:ir.model.fields,field_description:mpf_crm.field_account_bank_statement_line__lead_brand_id +#: model:ir.model.fields,field_description:mpf_crm.field_account_move__lead_brand_id +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__brand_id +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_opportunity_report_view_search +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_account_invoice_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_opportunities_filter +msgid "Brand" +msgstr "Marca" + +#. module: mpf_crm +#: model:ir.actions.act_window,name:mpf_crm.crm_lead_brand_action +#: model:ir.ui.menu,name:mpf_crm.menu_crm_lead_brand +msgid "Brands" +msgstr "Marcas" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__cancelled_quotation_count +msgid "Cancelled quotations" +msgstr "Presupuestos cancelados" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__create_uid +#: model:ir.model.fields,field_description:mpf_crm.field_brand__create_uid +#: model:ir.model.fields,field_description:mpf_crm.field_type__create_uid +msgid "Created by" +msgstr "Agrupar por" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__create_date +#: model:ir.model.fields,field_description:mpf_crm.field_brand__create_date +#: model:ir.model.fields,field_description:mpf_crm.field_type__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_type +msgid "Crm Lead Type" +msgstr "Tipo crm lead" + +#. module: mpf_crm +#: model:ir.ui.menu,name:mpf_crm.crm_custom_menu_config +msgid "Customizations" +msgstr "Personalizaciones" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__name +#: model:ir.model.fields,field_description:mpf_crm.field_brand__name +#: model:ir.model.fields,field_description:mpf_crm.field_type__name +msgid "Description" +msgstr "Descripción" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__display_name +#: model:ir.model.fields,field_description:mpf_crm.field_brand__display_name +#: model:ir.model.fields,field_description:mpf_crm.field_type__display_name +msgid "Display Name" +msgstr "Mostar nombre" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__id +#: model:ir.model.fields,field_description:mpf_crm.field_brand__id +#: model:ir.model.fields,field_description:mpf_crm.field_type__id +msgid "ID" +msgstr "" + +#. module: mpf_crm +#: model:ir.actions.act_window,name:mpf_crm.crm_lead_belongs_action +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__belong_id +#: model:ir.ui.menu,name:mpf_crm.menu_crm_lead_belong +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_belongs_tree_view +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_opportunity_report_view_search +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_opportunities_filter +msgid "It belongs to" +msgstr "Pertenece a" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_account_move +msgid "Journal Entry" +msgstr "Asiento contable" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__write_uid +#: model:ir.model.fields,field_description:mpf_crm.field_brand__write_uid +#: model:ir.model.fields,field_description:mpf_crm.field_type__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__write_date +#: model:ir.model.fields,field_description:mpf_crm.field_brand__write_date +#: model:ir.model.fields,field_description:mpf_crm.field_type__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__lead_type_id +msgid "Lead Type" +msgstr "Tipo lead" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Lead/Oportunidad" + +#. module: mpf_crm +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_brand_tree_view +msgid "Master of brands" +msgstr "Maestro de marcas" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_account_bank_statement_line__opportunity_id +#: model:ir.model.fields,field_description:mpf_crm.field_account_move__opportunity_id +msgid "Opportunity" +msgstr "Oportunidad" + +#. module: mpf_crm +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +msgid "Pres.cancel." +msgstr "Presionar cancelar" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_sale_order +msgid "Sales Order" +msgstr "Pedido de venta" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_account_bank_statement_line__lead_type_id +#: model:ir.model.fields,field_description:mpf_crm.field_account_move__lead_type_id +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_opportunity_report_view_search +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_account_invoice_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_opportunities_filter +msgid "Type" +msgstr "Tipo" + +#. module: mpf_crm +#: model:ir.actions.act_window,name:mpf_crm.crm_lead_type_action +#: model:ir.ui.menu,name:mpf_crm.menu_crm_lead_type +msgid "Types" +msgstr "Tipos" + +#. module: mpf_crm +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_type_tree_view +msgid "Types (master)" +msgstr "Tipos (maestro)" diff --git a/mpf_crm/i18n/mpf_crm.pot b/mpf_crm/i18n/mpf_crm.pot new file mode 100644 index 0000000..36de9b4 --- /dev/null +++ b/mpf_crm/i18n/mpf_crm.pot @@ -0,0 +1,181 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mpf_crm +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-01-08 11:57+0000\n" +"PO-Revision-Date: 2026-01-08 11:57+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: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__lead_ids +#: model:ir.model.fields,field_description:mpf_crm.field_brand__lead_ids +#: model:ir.model.fields,field_description:mpf_crm.field_type__lead_ids +msgid "Assigned leads" +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_belongs +msgid "Belongs to" +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_brand +#: model:ir.model.fields,field_description:mpf_crm.field_account_bank_statement_line__lead_brand_id +#: model:ir.model.fields,field_description:mpf_crm.field_account_move__lead_brand_id +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__brand_id +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_opportunity_report_view_search +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_account_invoice_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_opportunities_filter +msgid "Brand" +msgstr "" + +#. module: mpf_crm +#: model:ir.actions.act_window,name:mpf_crm.crm_lead_brand_action +#: model:ir.ui.menu,name:mpf_crm.menu_crm_lead_brand +msgid "Brands" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__cancelled_quotation_count +msgid "Cancelled quotations" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__create_uid +#: model:ir.model.fields,field_description:mpf_crm.field_brand__create_uid +#: model:ir.model.fields,field_description:mpf_crm.field_type__create_uid +msgid "Created by" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__create_date +#: model:ir.model.fields,field_description:mpf_crm.field_brand__create_date +#: model:ir.model.fields,field_description:mpf_crm.field_type__create_date +msgid "Created on" +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_type +msgid "Crm Lead Type" +msgstr "" + +#. module: mpf_crm +#: model:ir.ui.menu,name:mpf_crm.crm_custom_menu_config +msgid "Customizations" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__name +#: model:ir.model.fields,field_description:mpf_crm.field_brand__name +#: model:ir.model.fields,field_description:mpf_crm.field_type__name +msgid "Description" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__display_name +#: model:ir.model.fields,field_description:mpf_crm.field_brand__display_name +#: model:ir.model.fields,field_description:mpf_crm.field_type__display_name +msgid "Display Name" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__id +#: model:ir.model.fields,field_description:mpf_crm.field_brand__id +#: model:ir.model.fields,field_description:mpf_crm.field_type__id +msgid "ID" +msgstr "" + +#. module: mpf_crm +#: model:ir.actions.act_window,name:mpf_crm.crm_lead_belongs_action +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__belong_id +#: model:ir.ui.menu,name:mpf_crm.menu_crm_lead_belong +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_belongs_tree_view +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_opportunity_report_view_search +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_opportunities_filter +msgid "It belongs to" +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__write_uid +#: model:ir.model.fields,field_description:mpf_crm.field_brand__write_uid +#: model:ir.model.fields,field_description:mpf_crm.field_type__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_belongs__write_date +#: model:ir.model.fields,field_description:mpf_crm.field_brand__write_date +#: model:ir.model.fields,field_description:mpf_crm.field_type__write_date +msgid "Last Updated on" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_crm_lead__lead_type_id +msgid "Lead Type" +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_crm_lead +msgid "Lead/Opportunity" +msgstr "" + +#. module: mpf_crm +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_brand_tree_view +msgid "Master of brands" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_account_bank_statement_line__opportunity_id +#: model:ir.model.fields,field_description:mpf_crm.field_account_move__opportunity_id +msgid "Opportunity" +msgstr "" + +#. module: mpf_crm +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +msgid "Pres.cancel." +msgstr "" + +#. module: mpf_crm +#: model:ir.model,name:mpf_crm.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: mpf_crm +#: model:ir.model.fields,field_description:mpf_crm.field_account_bank_statement_line__lead_type_id +#: model:ir.model.fields,field_description:mpf_crm.field_account_move__lead_type_id +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_view_form +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_opportunity_report_view_search +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_account_invoice_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_leads_filter +#: model_terms:ir.ui.view,arch_db:mpf_crm.view_crm_case_opportunities_filter +msgid "Type" +msgstr "" + +#. module: mpf_crm +#: model:ir.actions.act_window,name:mpf_crm.crm_lead_type_action +#: model:ir.ui.menu,name:mpf_crm.menu_crm_lead_type +msgid "Types" +msgstr "" + +#. module: mpf_crm +#: model_terms:ir.ui.view,arch_db:mpf_crm.crm_lead_type_tree_view +msgid "Types (master)" +msgstr "" diff --git a/mpf_crm/models/__init__.py b/mpf_crm/models/__init__.py new file mode 100644 index 0000000..0436f7d --- /dev/null +++ b/mpf_crm/models/__init__.py @@ -0,0 +1,6 @@ +from . import brand +from . import type +from . import belongs +from . import crm_lead +from . import account_move +from . import sale_order diff --git a/mpf_crm/models/account_move.py b/mpf_crm/models/account_move.py new file mode 100644 index 0000000..5fa729f --- /dev/null +++ b/mpf_crm/models/account_move.py @@ -0,0 +1,27 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class AccountMove(models.Model): + _inherit = "account.move" + + opportunity_id = fields.Many2one( + comodel_name="crm.lead", + string="Opportunity", + check_company=True, + domain="[('type', '=', 'opportunity'), '|', ('company_id', '=', False)," + " ('company_id', '=', company_id)]", + ) + lead_type_id = fields.Many2one( + string="Type", + comodel_name="type", + related="opportunity_id.lead_type_id", + store=True, + ) + lead_brand_id = fields.Many2one( + string="Brand", + comodel_name="brand", + related="opportunity_id.brand_id", + store=True, + ) diff --git a/mpf_crm/models/belongs.py b/mpf_crm/models/belongs.py new file mode 100644 index 0000000..88d1086 --- /dev/null +++ b/mpf_crm/models/belongs.py @@ -0,0 +1,13 @@ +# Copyright 2025 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class Belongs(models.Model): + _name = "belongs" + _description = "Belongs to" + + name = fields.Char("Description", required=True, index=True) + lead_ids = fields.One2many( + string="Assigned leads", comodel_name="crm.lead", inverse_name="belong_id" + ) diff --git a/mpf_crm/models/brand.py b/mpf_crm/models/brand.py new file mode 100644 index 0000000..7d62643 --- /dev/null +++ b/mpf_crm/models/brand.py @@ -0,0 +1,13 @@ +# Copyright 2026 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class Brand(models.Model): + _name = "brand" + _description = "Brand" + + name = fields.Char("Description", required=True, index=True) + lead_ids = fields.One2many( + string="Assigned leads", comodel_name="crm.lead", inverse_name="brand_id" + ) diff --git a/mpf_crm/models/crm_lead.py b/mpf_crm/models/crm_lead.py new file mode 100644 index 0000000..a9fd69f --- /dev/null +++ b/mpf_crm/models/crm_lead.py @@ -0,0 +1,43 @@ +# Copyright 2026 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import api, fields, models + + +class CrmLead(models.Model): + _inherit = "crm.lead" + + cancelled_quotation_count = fields.Integer( + string="Cancelled quotations", compute="_compute_count_cancelled_quotations" + ) + lead_type_id = fields.Many2one( + string="Lead Type", comodel_name="type", index=True, ondelete="restrict" + ) + brand_id = fields.Many2one( + string="Brand", comodel_name="brand", index=True, ondelete="restrict" + ) + belong_id = fields.Many2one( + string="It belongs to", comodel_name="belongs", index=True, ondelete="restrict" + ) + + @api.depends("order_ids.state") + def _compute_count_cancelled_quotations(self): + for lead in self: + lead.cancelled_quotation_count = 0 + for order in lead.order_ids: + if order.state == "cancel": + lead.cancelled_quotation_count += 1 + + def action_view_sale_cancelled_quotation(self): + action = self.env["ir.actions.actions"]._for_xml_id( + "sale.action_quotations_with_onboarding" + ) + action["context"] = { + "default_partner_id": self.partner_id.id, + "default_opportunity_id": self.id, + } + action["domain"] = [("opportunity_id", "=", self.id), ("state", "=", "cancel")] + quotations = self.mapped("order_ids").filtered(lambda x: x.state in ("cancel")) + if len(quotations) == 1: + action["views"] = [(self.env.ref("sale.view_order_form").id, "form")] + action["res_id"] = quotations.id + return action diff --git a/mpf_crm/models/sale_order.py b/mpf_crm/models/sale_order.py new file mode 100644 index 0000000..8cc734c --- /dev/null +++ b/mpf_crm/models/sale_order.py @@ -0,0 +1,14 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + def _prepare_invoice(self): + self.ensure_one() + invoice_vals = super()._prepare_invoice() + if self.opportunity_id: + invoice_vals["opportunity_id"] = self.opportunity_id.id + return invoice_vals diff --git a/mpf_crm/models/type.py b/mpf_crm/models/type.py new file mode 100644 index 0000000..e02975b --- /dev/null +++ b/mpf_crm/models/type.py @@ -0,0 +1,13 @@ +# Copyright 2026 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class Type(models.Model): + _name = "type" + _description = "Crm Lead Type" + + name = fields.Char("Description", required=True, index=True) + lead_ids = fields.One2many( + string="Assigned leads", comodel_name="crm.lead", inverse_name="lead_type_id" + ) diff --git a/mpf_crm/pyproject.toml b/mpf_crm/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/mpf_crm/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mpf_crm/security/ir.model.access.csv b/mpf_crm/security/ir.model.access.csv new file mode 100644 index 0000000..0663f81 --- /dev/null +++ b/mpf_crm/security/ir.model.access.csv @@ -0,0 +1,7 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_brand_manager,brand,model_brand,sales_team.group_sale_manager,1,1,1,1 +access_type_manager,type,model_type,sales_team.group_sale_manager,1,1,1,1 +access_belongs_manager,belongs,model_belongs,sales_team.group_sale_manager,1,1,1,1 +access_brand,brand,model_brand,base.group_user,1,0,0,0 +access_type,type,model_type,base.group_user,1,0,0,0 +access_belongs,belongs,model_belongs,base.group_user,1,0,0,0 diff --git a/mpf_crm/views/account_move_views.xml b/mpf_crm/views/account_move_views.xml new file mode 100644 index 0000000..aad8817 --- /dev/null +++ b/mpf_crm/views/account_move_views.xml @@ -0,0 +1,61 @@ + + + + account.move + + + + + + + + + + + + account.move + + + + + + + + + + + + account.move + + + + + + + + + + + + + + diff --git a/mpf_crm/views/crm_lead_belong_views.xml b/mpf_crm/views/crm_lead_belong_views.xml new file mode 100644 index 0000000..769881c --- /dev/null +++ b/mpf_crm/views/crm_lead_belong_views.xml @@ -0,0 +1,37 @@ + + + + crm.lead_belongs.tree.view + belongs + + + + + + + + + It belongs to + ir.actions.act_window + belongs + list + + [] + {} + + + + + + diff --git a/mpf_crm/views/crm_lead_brand_views.xml b/mpf_crm/views/crm_lead_brand_views.xml new file mode 100644 index 0000000..abbf27e --- /dev/null +++ b/mpf_crm/views/crm_lead_brand_views.xml @@ -0,0 +1,29 @@ + + + + crm.lead_brand.tree.view + brand + + + + + + + + + Brands + ir.actions.act_window + brand + list + + [] + {} + + + + diff --git a/mpf_crm/views/crm_lead_type_views.xml b/mpf_crm/views/crm_lead_type_views.xml new file mode 100644 index 0000000..d31884a --- /dev/null +++ b/mpf_crm/views/crm_lead_type_views.xml @@ -0,0 +1,29 @@ + + + + crm.lead_type.tree.view + type + + + + + + + + + Types + ir.actions.act_window + type + list + + [] + {} + + + + diff --git a/mpf_crm/views/crm_lead_views.xml b/mpf_crm/views/crm_lead_views.xml new file mode 100644 index 0000000..d5bffb2 --- /dev/null +++ b/mpf_crm/views/crm_lead_views.xml @@ -0,0 +1,127 @@ + + + crm.lead + + + + + + + + + + + + + + crm.lead + + + + + + + + + + + + + + + + + + crm.lead + + + + + + + + + + + + + + + + + + crm.lead + + + + + + + + + + + + + + + +