Skip to content

Commit

Permalink
Merge PR #561 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Apr 15, 2024
2 parents 4c40a5d + e48bda5 commit a997aea
Show file tree
Hide file tree
Showing 19 changed files with 752 additions and 0 deletions.
103 changes: 103 additions & 0 deletions crm_won_restrict_per_stage/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
==========================
CRM Won Restrict Per Stage
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6ddd9b6e5295d8fb3fd803704dda6a5bcda0338a393e8a15e4f96b8c6d145f7e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-OCA%2Fcrm-lightgray.png?logo=github
:target: https://github.com/OCA/crm/tree/16.0/crm_won_restrict_per_stage
:alt: OCA/crm
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_won_restrict_per_stage
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds the possibility to set CRM stages that are being able to see the won
button (hiding it for the rest).
It also restricts to change to a won stage won from an stage that doesn't have this
check marked.

**Table of contents**

.. contents::
:local:

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

To configure this module, you need to:

1. Go to CRM --> Configuration --> Pipelines--> Stages
2. Check or uncheck "Show Won Button".

If you unchecked "Show Won Button", on that stage disappears Won Button.
Additionally, you won't be able to change to won stage from a stage with this configuration.

When installing the module, all CRM stages created are set by default to "Show Won Button".

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/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/OCA/crm/issues/new?body=module:%20crm_won_restrict_per_stage%0Aversion:%2016.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
~~~~~~~

* Tecnativa

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

* `Tecnativa <https://www.tecnativa.com>`_:

* Carolina Fernandez
* Pedro M. Baeza

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-carolina-fernandez| image:: https://github.com/carolina-fernandez.png?size=40px
:target: https://github.com/carolina-fernandez
:alt: carolina-fernandez

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-carolina-fernandez|

This module is part of the `OCA/crm <https://github.com/OCA/crm/tree/16.0/crm_won_restrict_per_stage>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions crm_won_restrict_per_stage/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions crm_won_restrict_per_stage/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Tecnativa Carolina Fernandez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

{
"name": "CRM Won Restrict Per Stage",
"version": "16.0.1.0.0",
"category": "Customer Relationship Management",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/crm",
"license": "AGPL-3",
"depends": ["crm"],
"data": ["views/crm_lead_views.xml", "views/crm_stage_views.xml"],
"installable": True,
"maintainers": ["carolina-fernandez"],
}
36 changes: 36 additions & 0 deletions crm_won_restrict_per_stage/i18n/crm_won_restrict_per_stage.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_won_restrict_per_stage
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \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_won_restrict_per_stage
#: model:ir.model,name:crm_won_restrict_per_stage.model_crm_stage
msgid "CRM Stages"
msgstr ""

#. module: crm_won_restrict_per_stage
#: model:ir.model,name:crm_won_restrict_per_stage.model_crm_lead
msgid "Lead/Opportunity"
msgstr ""

#. module: crm_won_restrict_per_stage
#: model:ir.model.fields,field_description:crm_won_restrict_per_stage.field_crm_lead__show_won_button
#: model:ir.model.fields,field_description:crm_won_restrict_per_stage.field_crm_stage__show_won_button
msgid "Show Won Button"
msgstr ""

#. module: crm_won_restrict_per_stage
#: code:addons/crm_won_restrict_per_stage/models/crm_lead.py:0
#, python-format
msgid "You can't change to this stage from the current stage."
msgstr ""
39 changes: 39 additions & 0 deletions crm_won_restrict_per_stage/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_won_restrict_per_stage
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-07 20:40+0000\n"
"PO-Revision-Date: 2024-03-07 20: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"
"Plural-Forms: \n"

#. module: crm_won_restrict_per_stage
#: model:ir.model,name:crm_won_restrict_per_stage.model_crm_stage
msgid "CRM Stages"
msgstr "Etapas del CRM"

#. module: crm_won_restrict_per_stage
#: model:ir.model,name:crm_won_restrict_per_stage.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Lead/Oportunidad"

#. module: crm_won_restrict_per_stage
#: model:ir.model.fields,field_description:crm_won_restrict_per_stage.field_crm_lead__show_won_button
#: model:ir.model.fields,field_description:crm_won_restrict_per_stage.field_crm_stage__show_won_button
msgid "Show Won Button"
msgstr "Mostrar botón Ganado"

#. module: crm_won_restrict_per_stage
#: code:addons/crm_won_restrict_per_stage/models/crm_lead.py:0
#, python-format
msgid "You can't change to this stage from the current stage."
msgstr "No puede cambiar a esta etapa desde la etapa actual."
2 changes: 2 additions & 0 deletions crm_won_restrict_per_stage/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import crm_stage
from . import crm_lead
21 changes: 21 additions & 0 deletions crm_won_restrict_per_stage/models/crm_lead.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

from odoo import _, fields, models
from odoo.exceptions import ValidationError


class CrmStage(models.Model):
_inherit = "crm.lead"

show_won_button = fields.Boolean(related="stage_id.show_won_button")

def write(self, vals):
for rec in self:
if vals.get("stage_id"):
stage = self.env["crm.stage"].browse(vals.get("stage_id"))
if stage.is_won and not rec.stage_id.show_won_button:
raise ValidationError(
_("You can't change to this stage from the current stage.")
)
return super().write(vals)
10 changes: 10 additions & 0 deletions crm_won_restrict_per_stage/models/crm_stage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2024 Tecnativa - Carolina Fernandez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

from odoo import fields, models


class CrmStage(models.Model):
_inherit = "crm.stage"

show_won_button = fields.Boolean(default=True)
9 changes: 9 additions & 0 deletions crm_won_restrict_per_stage/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
To configure this module, you need to:

1. Go to CRM --> Configuration --> Pipelines--> Stages
2. Check or uncheck "Show Won Button".

If you unchecked "Show Won Button", on that stage disappears Won Button.
Additionally, you won't be able to change to won stage from a stage with this configuration.

When installing the module, all CRM stages created are set by default to "Show Won Button".
4 changes: 4 additions & 0 deletions crm_won_restrict_per_stage/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Carolina Fernandez
* Pedro M. Baeza
4 changes: 4 additions & 0 deletions crm_won_restrict_per_stage/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module adds the possibility to set CRM stages that are being able to see the won
button (hiding it for the rest).
It also restricts to change to a won stage won from an stage that doesn't have this
check marked.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a997aea

Please sign in to comment.