diff --git a/pms_crm/README.rst b/pms_crm/README.rst new file mode 100644 index 000000000..440cc1479 --- /dev/null +++ b/pms_crm/README.rst @@ -0,0 +1,92 @@ +======= +PMS CRM +======= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhttps://github.com/OCA/pms-lightgray.png?logo=github + :target: https://github.com/OCA/https://github.com/OCA/pms/tree/14.0-add-pms_crm/pms_crm + :alt: OCA/https://github.com/OCA/pms +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/https://github.com/OCA/pms-14-0-add-pms_crm/https://github.com/OCA/pms-14-0-add-pms_crm-pms_crm + :alt: Translate me on Weblate + +|badge1| |badge2| |badge3| |badge4| + +This module allows you to link your leads to properties. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* Go to CRM +* Create or select a lead +* Select the properties related to the lead + +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 +~~~~~~~ + +* Open Source Integrators + +Contributors +~~~~~~~~~~~~ + +* `Open Source Integrators `: + + * Maxime Chambreuil + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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-max3903| image:: https://github.com/max3903.png?size=40px + :target: https://github.com/max3903 + :alt: max3903 + +Current `maintainer `__: + +|maintainer-max3903| + +This module is part of the `OCA/https://github.com/OCA/pms `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pms_crm/__init__.py b/pms_crm/__init__.py new file mode 100644 index 000000000..02179fb04 --- /dev/null +++ b/pms_crm/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import models diff --git a/pms_crm/__manifest__.py b/pms_crm/__manifest__.py new file mode 100644 index 000000000..db3d523bd --- /dev/null +++ b/pms_crm/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright (c) 2021 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "PMS CRM", + "summary": "Link leads to properties", + "version": "14.0.1.0.0", + "development_status": "Alpha", + "category": "Generic Modules/Property Management System", + "website": "https://github.com/OCA/pms", + "author": "Open Source Integrators, Odoo Community Association (OCA)", + "maintainers": ["max3903"], + "license": "AGPL-3", + "depends": ["crm", "pms_base"], + "data": ["views/crm_lead.xml", "views/pms_property.xml"], +} diff --git a/pms_crm/i18n/es.po b/pms_crm/i18n/es.po new file mode 100644 index 000000000..6d17d6d04 --- /dev/null +++ b/pms_crm/i18n/es.po @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pms_crm +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0+e-20211202\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-23 19:40+0000\n" +"PO-Revision-Date: 2021-12-23 19:40+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: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_crm_lead__display_name +#: model:ir.model.fields,field_description:pms_crm.field_pms_property__display_name +msgid "Display Name" +msgstr "" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_crm_lead__id +#: model:ir.model.fields,field_description:pms_crm.field_pms_property__id +msgid "ID" +msgstr "" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_crm_lead____last_update +#: model:ir.model.fields,field_description:pms_crm.field_pms_property____last_update +msgid "Last Modified on" +msgstr "" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_pms_property__lead_count +msgid "Lead Count" +msgstr "Numéro de pista" + +#. module: pms_crm +#: model:ir.model,name:pms_crm.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Pista/Oportunidad" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_pms_property__lead_ids +#: model_terms:ir.ui.view,arch_db:pms_crm.view_pms_property_form +msgid "Leads" +msgstr "Pistas" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_crm_lead__property_ids +#: model_terms:ir.ui.view,arch_db:pms_crm.view_crm_lead_form +msgid "Properties" +msgstr "Propiedades" + +#. module: pms_crm +#: model:ir.model,name:pms_crm.model_pms_property +msgid "Property" +msgstr "Propiedad" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_crm_lead__property_count +msgid "Property Count" +msgstr "Numéro de propiedad" diff --git a/pms_crm/i18n/pms_crm.pot b/pms_crm/i18n/pms_crm.pot new file mode 100644 index 000000000..6d17d6d04 --- /dev/null +++ b/pms_crm/i18n/pms_crm.pot @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pms_crm +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0+e-20211202\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-23 19:40+0000\n" +"PO-Revision-Date: 2021-12-23 19:40+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: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_crm_lead__display_name +#: model:ir.model.fields,field_description:pms_crm.field_pms_property__display_name +msgid "Display Name" +msgstr "" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_crm_lead__id +#: model:ir.model.fields,field_description:pms_crm.field_pms_property__id +msgid "ID" +msgstr "" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_crm_lead____last_update +#: model:ir.model.fields,field_description:pms_crm.field_pms_property____last_update +msgid "Last Modified on" +msgstr "" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_pms_property__lead_count +msgid "Lead Count" +msgstr "Numéro de pista" + +#. module: pms_crm +#: model:ir.model,name:pms_crm.model_crm_lead +msgid "Lead/Opportunity" +msgstr "Pista/Oportunidad" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_pms_property__lead_ids +#: model_terms:ir.ui.view,arch_db:pms_crm.view_pms_property_form +msgid "Leads" +msgstr "Pistas" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_crm_lead__property_ids +#: model_terms:ir.ui.view,arch_db:pms_crm.view_crm_lead_form +msgid "Properties" +msgstr "Propiedades" + +#. module: pms_crm +#: model:ir.model,name:pms_crm.model_pms_property +msgid "Property" +msgstr "Propiedad" + +#. module: pms_crm +#: model:ir.model.fields,field_description:pms_crm.field_crm_lead__property_count +msgid "Property Count" +msgstr "Numéro de propiedad" diff --git a/pms_crm/models/__init__.py b/pms_crm/models/__init__.py new file mode 100644 index 000000000..ee1b10319 --- /dev/null +++ b/pms_crm/models/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import crm_lead, pms_property diff --git a/pms_crm/models/crm_lead.py b/pms_crm/models/crm_lead.py new file mode 100644 index 000000000..dcc02da6b --- /dev/null +++ b/pms_crm/models/crm_lead.py @@ -0,0 +1,35 @@ +# Copyright (c) 2021 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import api, fields, models + + +class CrmLead(models.Model): + _inherit = "crm.lead" + + property_ids = fields.Many2many( + "pms.property", + string="Properties", + copy=False, + ) + property_count = fields.Integer( + string="Property Count", + compute="_compute_propert_count", + readonly=True, + copy=False, + ) + + @api.depends("property_ids") + def _compute_property_count(self): + for lead in self: + lead.property_count = len(lead.property_ids) + + def action_view_properties(self): + action = self.env.ref("pms_base.action_pms_property").read()[0] + if self.property_count > 1: + action["domain"] = [("id", "in", self.property_ids.ids)] + elif self.property_ids: + action["views"] = [ + (self.env.ref("pms_base.view_pms_property_form").id, "form") + ] + action["res_id"] = self.property_ids.ids[0] + return action diff --git a/pms_crm/models/pms_property.py b/pms_crm/models/pms_property.py new file mode 100644 index 000000000..9e9bbe567 --- /dev/null +++ b/pms_crm/models/pms_property.py @@ -0,0 +1,33 @@ +# Copyright (c) 2021 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import api, fields, models + + +class PmsProperty(models.Model): + _inherit = "pms.property" + + lead_ids = fields.Many2many( + "crm.lead", + string="Leads", + copy=False, + ) + lead_count = fields.Integer( + string="Lead Count", + compute="_compute_lead_count", + readonly=True, + copy=False, + ) + + @api.depends("lead_ids") + def _compute_lead_count(self): + for property in self: + property.lead_count = len(property.lead_ids) + + def action_view_leads(self): + action = self.env.ref("crm.crm_lead_all_leads").read()[0] + if self.lead_count > 1: + action["domain"] = [("id", "in", self.lead_ids.ids)] + elif self.lead_ids: + action["views"] = [(self.env.ref("crm.crm_lead_view_form").id, "form")] + action["res_id"] = self.lead_ids.ids[0] + return action diff --git a/pms_crm/readme/CONTRIBUTORS.rst b/pms_crm/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..306ebdcc9 --- /dev/null +++ b/pms_crm/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Open Source Integrators `: + + * Maxime Chambreuil diff --git a/pms_crm/readme/DESCRIPTION.rst b/pms_crm/readme/DESCRIPTION.rst new file mode 100644 index 000000000..53814b7a7 --- /dev/null +++ b/pms_crm/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows you to link your leads to properties. diff --git a/pms_crm/readme/USAGE.rst b/pms_crm/readme/USAGE.rst new file mode 100644 index 000000000..f8b0d5bbd --- /dev/null +++ b/pms_crm/readme/USAGE.rst @@ -0,0 +1,3 @@ +* Go to CRM +* Create or select a lead +* Select the properties related to the lead diff --git a/pms_crm/static/description/icon.png b/pms_crm/static/description/icon.png new file mode 100644 index 000000000..a81dd64c3 Binary files /dev/null and b/pms_crm/static/description/icon.png differ diff --git a/pms_crm/static/description/index.html b/pms_crm/static/description/index.html new file mode 100644 index 000000000..5f5c1b565 --- /dev/null +++ b/pms_crm/static/description/index.html @@ -0,0 +1,439 @@ + + + + + + +PMS CRM + + + +
+

PMS CRM

+ + +

Alpha License: AGPL-3 OCA/https://github.com/OCA/pms Translate me on Weblate

+

This module allows you to link your leads to properties.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Usage

+
    +
  • Go to CRM
  • +
  • Create or select a lead
  • +
  • Select the properties related to the lead
  • +
+
+
+

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

+
    +
  • Open Source Integrators
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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:

+

max3903

+

This module is part of the OCA/https://github.com/OCA/pms project on GitHub.

+

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

+
+
+
+ + diff --git a/pms_crm/views/crm_lead.xml b/pms_crm/views/crm_lead.xml new file mode 100644 index 000000000..52ae74db5 --- /dev/null +++ b/pms_crm/views/crm_lead.xml @@ -0,0 +1,19 @@ + + + + crm.lead.form + crm.lead + + + + + + + + + + + diff --git a/pms_crm/views/pms_property.xml b/pms_crm/views/pms_property.xml new file mode 100644 index 000000000..d602eb3be --- /dev/null +++ b/pms_crm/views/pms_property.xml @@ -0,0 +1,21 @@ + + + + pms.property.form + pms.property + + + + + + + + + diff --git a/setup/pms_crm/odoo/addons/pms_crm b/setup/pms_crm/odoo/addons/pms_crm new file mode 120000 index 000000000..c1ffa0a6c --- /dev/null +++ b/setup/pms_crm/odoo/addons/pms_crm @@ -0,0 +1 @@ +../../../../pms_crm \ No newline at end of file diff --git a/setup/pms_crm/setup.py b/setup/pms_crm/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/pms_crm/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)