-
-
Notifications
You must be signed in to change notification settings - Fork 896
[19.0][ADD] project_profitability_threshold_alert: Notify project followers and project manager about costs exceeding based on a set threshold #1660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 19.0
Are you sure you want to change the base?
Changes from all commits
d705f8d
1653c40
600cc54
4ebe0d5
8d02e22
b12a5ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import models |
| 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": [], | ||
| } |
| 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> |
| 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> | ||
| <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> | ||
| 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> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: |
||
| <field name="model_id" ref="project.model_project_project" /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: |
||
| <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> | ||
There was a problem hiding this comment.
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.).