Skip to content

Commit

Permalink
[15.0][ADD] crm_won_restrict_per_stage: New module
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinafernandez-tecnativa committed Mar 7, 2024
1 parent 213a246 commit eccbeb3
Show file tree
Hide file tree
Showing 17 changed files with 701 additions and 0 deletions.
86 changes: 86 additions & 0 deletions crm_won_restrict_per_stage/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
==========================
CRM Won Restrict Per Stage
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:504c79b322c3ce4e7481c9b95d4b10d426c8cbc26524a921e62f257c2127f432
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/15.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-15-0/crm-15-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=15.0
:alt: Try me on Runboat

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

This module adds possibility to set CRM stages that are being able to see won button and restrict change to an stage won that is not previous set to see won button

**Table of contents**

.. contents::
:local:

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:%2015.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

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/15.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": "15.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_views.xml"],
"installable": True,
"maintainers": ["carolina-fernandez"],
}
38 changes: 38 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,38 @@
# 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"
"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 "The stage must have checked Show won button"
msgstr ""
38 changes: 38 additions & 0 deletions crm_won_restrict_per_stage/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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"
"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 "The stage must have checked Show won button"
msgstr "La etapa tiene que tener configurada Mostrar botón Ganado"
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
18 changes: 18 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,18 @@
# 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):
if vals.get("stage_id"):
stage = self.env["crm.stage"].browse(vals.get("stage_id"))
if stage.is_won and not self.stage_id.show_won_button:
raise ValidationError(_("The stage must have checked Show won button"))
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)
3 changes: 3 additions & 0 deletions crm_won_restrict_per_stage/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Carolina Fernandez
1 change: 1 addition & 0 deletions crm_won_restrict_per_stage/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds possibility to set CRM stages that are being able to see won button and restrict change to an stage won that is not previous set to see won button
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 eccbeb3

Please sign in to comment.