Skip to content

Conversation

@nihelgabsi-acsone
Copy link

@nihelgabsi-acsone nihelgabsi-acsone commented Jan 22, 2026

Notify followers and project manager about costs exceeding based on a set threshold

… and project manager about budget exceeding based on a set threshold
@nihelgabsi-acsone nihelgabsi-acsone marked this pull request as draft January 22, 2026 08:31
@nihelgabsi-acsone nihelgabsi-acsone changed the title [19.0][ADD] project_budget_threshold_alert : Notify project followers… [19.0][ADD] project_budget_threshold_alert : Notify project followers and project manager about budget exceeding based on a set threshold Jan 22, 2026
@nihelgabsi-acsone nihelgabsi-acsone force-pushed the 19.0-project_budget_threshold_alert-nga branch 2 times, most recently from 050db67 to be238cd Compare January 28, 2026 14:34
@nihelgabsi-acsone nihelgabsi-acsone changed the title [19.0][ADD] project_budget_threshold_alert : Notify project followers and project manager about budget exceeding based on a set threshold [19.0][ADD] project_profitability_threshold_alert: Notify project followers and project manager about costs exceeding based on a set threshold Jan 28, 2026
@nihelgabsi-acsone nihelgabsi-acsone force-pushed the 19.0-project_budget_threshold_alert-nga branch from be238cd to 5a29fe3 Compare January 28, 2026 15:42
def _cron_find_costs_threshold_exceeded(self):
projects = self.env["project.project"].search([("active", "=", True)])
for project in projects:
project._compute_is_cost_exceeded()

Choose a reason for hiding this comment

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

Is this really necessary ? The compute is triggered by its depends.

Copy link
Author

Choose a reason for hiding this comment

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

I need to execute _get_profitability_items() to get updated data related to project costs and revenues

projects = self.env["project.project"].search([("active", "=", True)])
for project in projects:
project._compute_is_cost_exceeded()
if project.is_cost_exceeded and not project.is_notfication_sent:

Choose a reason for hiding this comment

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

Those fields should be included in search criteria (add a dedicated method for the domain like _get_costs_threshold_notification_domain())

email_layout_xmlid=None,
)

@api.depends("costs_threshold", "company_id.project_costs_threshold")

Choose a reason for hiding this comment

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

So, no need of company_id.project_cost_threshold

internal_user_followers += manager
return internal_user_followers

@api.onchange("costs_threshold")

Choose a reason for hiding this comment

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

Set is_notification_sent as computed / store=True depending on costs_threshold to avoid onchanges.

- Rename module to be more generic
- Add costs vs revenues threshold
@nihelgabsi-acsone nihelgabsi-acsone force-pushed the 19.0-project_budget_threshold_alert-nga branch from 5a29fe3 to 1653c40 Compare January 29, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants