Merge branch 'new/15.0/H11045_project_exception__generate_exception_while_creating_task' into '15.0-test'

new/15.0/H11045_project_exception__generate_exception_while_creating_task into 15.0-test

See merge request hibou-io/hibou-odoo/suite!1506
This commit is contained in:
Hibou Bot
2022-10-10 16:29:34 +00:00

View File

@@ -1,6 +1,7 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from odoo import api, models, fields
from odoo import api, models, fields, _
from odoo.exceptions import UserError
class ExceptionRule(models.Model):
@@ -41,11 +42,13 @@ class Task(models.Model):
return 'task_ids'
def write(self, vals):
if not vals.get('ignore_exception'):
if not vals.get('ignore_exception') and 'stage_id' in vals and 'project_id' not in vals:
for task in self:
if task.detect_exceptions():
return self._popup_exceptions()
return super().write(vals)
raise UserError(_('Exceptions were detected.'))
res = super().write(vals)
self.detect_exceptions()
return res
@api.model
def _get_popup_action(self):