Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions project_minimum_margin_threshold_alert/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

======================================
Project Minimum Margin Threshold Alert
======================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4c63603caa206ac1496ddecbe6881c78356e0909339c8cb1775ef4d6c347b7e7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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%2Fproject-lightgray.png?logo=github
:target: https://github.com/OCA/project/tree/19.0/project_minimum_margin_threshold_alert
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-19-0/project-19-0-project_minimum_margin_threshold_alert
: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/project&target_branch=19.0
:alt: Try me on Runboat

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

This module extends the Odoo Project application to support automatic
margin minimum threshold alerts. It allows companies to define a default
margin limit (for example when project costs exceed a given percentage
of revenues) and to apply it to projects that do not have a specific
alert configuration. Each project can also define its own threshold.

When the margin threshold is reached or exceeded, the system sends
notifications to the project manager and to internal subscribers of the
project. The notification method follows the user’s notification
preferences, with an option to force the sending of an email even if the
user is configured to receive only in-app notifications. This module
helps project managers anticipate financial risks and improves internal
communication around project margin.

**Table of contents**

.. contents::
:local:

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

**1. Configure the default minimum margin threshold**

- Go to Settings > Project > Set the default threshold percentage
|screenshot.png|

**2. Configure a project-specific minimum margin threshold (optional)**

- Go to Project > Open a project > Manage notifications section > Define
a specific threshold for this project.

**3. Manage notification recipients**

- Define a Project Manager and followers (subscribers) for the project
These users will receive notifications when the threshold is reached.

**4. User notification preferences**

- Go to Settings > Open a user > Configure the user’s notification
preferences. |screenshot1.png|

**5. Project notification preferences**

When project costs exceed the configured percentage of revenues, the
system automatically sends (via a cron)

- An email to manager and internal user followers if the Force Email
Notification option is enabled from the project.
- An activity of type 'Minimum Margin Exceeded' for the project manager
if the Create Activity option is enabled from the project.

|screenshot2.png|

.. |screenshot.png| image:: https://raw.githubusercontent.com/OCA/project/19.0/project_minimum_margin_threshold_alert/static/description/screenshot.png
.. |screenshot1.png| image:: https://raw.githubusercontent.com/OCA/project/19.0/project_minimum_margin_threshold_alert/static/description/screenshot1.png
.. |screenshot2.png| image:: https://raw.githubusercontent.com/OCA/project/19.0/project_minimum_margin_threshold_alert/static/description/screenshot2.png

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

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

* ACSONE SA/NV

Contributors
------------

- Nihel GABSI nihel.gabsi@acsone.eu (https://www.acsone.eu/)

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.

This module is part of the `OCA/project <https://github.com/OCA/project/tree/19.0/project_minimum_margin_threshold_alert>`_ 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 project_minimum_margin_threshold_alert/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions project_minimum_margin_threshold_alert/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2026 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Project Minimum Margin Threshold Alert",
"summary": """Send notification when project costs threshold is exceeded""",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/project",
"depends": ["project"],
"data": [
"views/res_config_settings.xml",
"views/res_users.xml",
"views/project_project.xml",
"data/cron.xml",
"data/mail_template.xml",
"data/activity_type.xml",
],
"demo": [],
}
12 changes: 12 additions & 0 deletions project_minimum_margin_threshold_alert/data/activity_type.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2026 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">
<record id="mail_activity_type_margin_threshold" model="mail.activity.type">
<field name="name">Minimum Margin Exceeded</field>
<field name="summary">Project margin threshold exceeded</field>
<field name="icon">fa-level-down</field>
<field name="sequence">100</field>
<field name="res_model">project.project</field>
</record>
</odoo>
13 changes: 13 additions & 0 deletions project_minimum_margin_threshold_alert/data/cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2026 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider wrapping this in <odoo noupdate="1"> so that module updates do not overwrite any user customizations to the cron schedule (interval, active status, etc.).

<record id="ir_cron_project_margin_exceeded" model="ir.cron">
<field name="name">Project: Manage Projects with minimum margin exceeded</field>
<field name="model_id" ref="model_project_project" />
<field name="state">code</field>
<field name="code">model._cron_margin_threshold_exceeded()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
</record>
</odoo>
36 changes: 36 additions & 0 deletions project_minimum_margin_threshold_alert/data/mail_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2026 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="project_minimum_margin_exceeded_template" model="mail.template">
<field name="name">Project: Minimum Margin threashold exceeded</field>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: threasholdthreshold (in the template name and subject line)

<field name="model_id" ref="project.model_project_project" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "threashold" should be "threshold" in both the template name and the subject line (line 8).

<field name="subject">{{ object.name }}: Costs Threashold Exceeded</field>
<field
name="description"
>Automated notification sent to the project subscribers to inform about project Costs vs Revenues
threshold exceeding
</field>
<field name="body_html" type="html">
<p>Hello,</p>
<br />
<p>
This is an automated notification to inform you that the costs threshold for the project
<strong>
<t t-out="object.name" />
</strong> has been exceeded.
</p>
<p>
Please review the project and take any necessary actions.
</p>
<br />
<br />
<p>
Best regards,
<br />
<t t-out="object.company_id.name" />
</p>
</field>
<field name="lang">{{ object.user_id.lang }}</field>
</record>
</odoo>
Loading