mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[ADD] project_exception: when new task is created and has no project_id then an exception is raised
H11045
This commit is contained in:
@@ -1 +1,3 @@
|
||||
from . import project_exception_confim
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from . import project_exception_confim
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ProjectExceptionConfirm(models.TransientModel):
|
||||
_name = 'project.exception.confirm'
|
||||
_inherit = ['exception.rule.confirm']
|
||||
_description = 'Project Exception Confirm Wizard'
|
||||
|
||||
related_model_id = fields.Many2one('project.task', 'Task')
|
||||
|
||||
def action_confirm(self):
|
||||
self.ensure_one()
|
||||
if self.ignore:
|
||||
self.related_model_id.ignore_exception = True
|
||||
res = super().action_confirm()
|
||||
if self.ignore:
|
||||
return True
|
||||
else:
|
||||
return res
|
||||
|
||||
def _action_ignore(self):
|
||||
self.related_model_id.ignore_exception = True
|
||||
super()._action_ignore()
|
||||
return True
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_project_exception_confirm" model="ir.ui.view">
|
||||
<field name="name">Project Exceptions Rules</field>
|
||||
<field name="model">project.exception.confirm</field>
|
||||
<field name="inherit_id" ref="base_exception.view_exception_rule_confirm"/>
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//footer" position="inside">
|
||||
<button class="oe_link" special="cancel" string="Cancel"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_project_exception_confirm" model="ir.actions.act_window">
|
||||
<field name="name">Blocked due to exceptions</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">project.exception.confirm</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_project_exception_confirm"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user