Skip to content

Commit

Permalink
[T-6494][MIG]: crm_assign_project: migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tisho99 committed Sep 25, 2024
1 parent 39678be commit 31c1214
Show file tree
Hide file tree
Showing 14 changed files with 608 additions and 52 deletions.
88 changes: 49 additions & 39 deletions crm_assign_project/README.rst
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,79 +1,89 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

==================
CRM Assign Project
==================

This module allows to automatically assign a project to a CRM lead when a lead/opportunity is created through an email.
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f12f92a7b3b43b634b25a7a9cfeb8d47e6e839783428e0a4f466c00ac654b700
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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-sygel--technology%2Fsy--crm-lightgray.png?logo=github
:target: https://github.com/sygel-technology/sy-crm/tree/17.0/crm_assign_project
:alt: sygel-technology/sy-crm

Installation
============
|badge1| |badge2| |badge3|

To install this module, you need to:
This module allows to automatically assign a project to a CRM lead when
a lead/opportunity is created through an email.

#. Only install.
**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

#. Go to CRM > Configuration > Sales Teams and select a team.
#. Check the 'Assign Project' checkbox
#. Select a value in 'Automatically Assigned Project'

1. Go to CRM > Configuration > Sales Teams and select a team.
2. Check the 'Assign Project' checkbox
3. Select a value in 'Automatically Assigned Project'

Usage
=====

To use this module, you need to:

#. ...


ROADMAP
=======
To usage this module, you need to:

1. Create a new Lead, manually or sending a email to an alias, with a
Crm Team with a project_id
2. The created lead will have the configured project_id

* ...
Known issues / Roadmap
======================

- Manually created leads with the fast creation popup wizard won't have
a default project_id, even if the user has a default team_id with a
default project_id. The reason is this is made with an onchange.

Bug Tracker
===========

Bugs and errors are managed in `issues of GitHub <https://github.com/sygel-technology/REPOSITORY/issues>`_.
In case of problems, please check if your problem has already been
reported. If you are the first to discover it, help us solving it by indicating
a detailed description `here <https://github.com/sygel-technology/REPOSITORY/issues/new>`_.
Bugs are tracked on `GitHub Issues <https://github.com/sygel-technology/sy-crm/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/sygel-technology/sy-crm/issues/new?body=module:%20crm_assign_project%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.


Credits
=======

Authors
~~~~~~~

* Sygel, Odoo Community Association (OCA)
-------

* Sygel

Contributors
~~~~~~~~~~~~

* Manuel Regidor <manuel.regidor@sygel.es>


Maintainer
~~~~~~~~~~
------------

This module is maintained by Sygel.
- Harald Panten harald.panten@sygel.es
- Valentin Vinagre valentin.vinagre@sygel.es
- Alberto Martínez alberto.martinez@sygel.es
- Roger Sans roger.sans@sygel.es

Maintainers
-----------

This module is part of the `Sygel/REPOSITORY <https://github.com/REPOSITORY/sy-server-backend>`_.
This module is part of the `sygel-technology/sy-crm <https://github.com/sygel-technology/sy-crm/tree/17.0/crm_assign_project>`_ project on GitHub.

To contribute to this module, please visit https://github.com/sygel-technology.
You are welcome to contribute.
Empty file modified crm_assign_project/__init__.py
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion crm_assign_project/__manifest__.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "CRM Assign Project",
"summary": "Automatically assign project to CRM lead.",
"version": "12.0.1.0.0",
"version": "17.0.1.0.0",
"category": "CRM",
"website": "https://github.com/sygel-technology/sy-crm",
"author": "Sygel, Odoo Community Association (OCA)",
Expand Down
Empty file modified crm_assign_project/models/__init__.py
100755 → 100644
Empty file.
21 changes: 11 additions & 10 deletions crm_assign_project/models/crm_team.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models
from odoo import fields, models


class CrmTeam(models.Model):
Expand All @@ -15,25 +15,26 @@ class CrmTeam(models.Model):
comodel_name="project.project",
)

@api.multi
def write(self, vals):
values = super(CrmTeam, self).write(vals)
values = super().write(vals)
if (
"automatic_project_assignation" in vals
or "automatic_assignation_project_id" in vals
) and self.alias_id:
alias_values = self.get_alias_values()
alias_values = self._alias_get_creation_values()
self.alias_id.write({"alias_defaults": alias_values["alias_defaults"]})
return values

def get_alias_values(self):
values = super(CrmTeam, self).get_alias_values()
def _alias_get_creation_values(self):
values = super()._alias_get_creation_values()
if self.automatic_project_assignation and self.automatic_assignation_project_id:
values["alias_defaults"][
"project_id"
] = self.automatic_assignation_project_id.id
elif not self.automatic_project_assignation and values.get(
"alias_defaults"
).get("project_id"):
del values.get("alias_defaults")["project_id"]
elif (
not self.automatic_project_assignation
and values.get("alias_defaults")
and values.get("alias_defaults").get("project_id")
):
values.get("alias_defaults").pop("project_id")
return values
5 changes: 5 additions & 0 deletions crm_assign_project/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To configure this module, you need to:

1. Go to CRM > Configuration > Sales Teams and select a team.
2. Check the 'Assign Project' checkbox
3. Select a value in 'Automatically Assigned Project'
4 changes: 4 additions & 0 deletions crm_assign_project/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Harald Panten <harald.panten@sygel.es>
- Valentin Vinagre <valentin.vinagre@sygel.es>
- Alberto Martínez <alberto.martinez@sygel.es>
- Roger Sans <roger.sans@sygel.es>
1 change: 1 addition & 0 deletions crm_assign_project/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows to automatically assign a project to a CRM lead when a lead/opportunity is created through an email.
1 change: 1 addition & 0 deletions crm_assign_project/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Manually created leads with the fast creation popup wizard won't have a default project_id, even if the user has a default team_id with a default project_id. The reason is this is made with an onchange.
4 changes: 4 additions & 0 deletions crm_assign_project/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To usage this module, you need to:

1. Create a new Lead, manually or sending a email to an alias, with a Crm Team with a project_id
2. The created lead will have the configured project_id
Loading

0 comments on commit 31c1214

Please sign in to comment.