Merge pull request #5007 from expsa/yt_dev_odex25_base

[FIX] system_dashboard_classic: FIX bug delete nodes
This commit is contained in:
kchyounes19 2025-10-21 10:25:33 +01:00 committed by GitHub
commit fa35a3309e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 3 deletions

View File

@ -428,3 +428,8 @@ msgstr ""
#: model:ir.model.fields,field_description:system_dashboard_classic.field_stage_stage__value
msgid "value"
msgstr "القيمة"
#. module: system_dashboard_classic
#: model_terms:ir.ui.view,arch_db:system_dashboard_classic.view_base_dashboard_form
msgid "Unlink Nodes"
msgstr "حذف المراحل"

View File

@ -74,6 +74,18 @@ class BaseDashboard(models.Model):
relation = fields.Char(
string='action_domain',
)
def unlink_nodes(self):
for rec in self:
rec.is_button = False
nodes = self.env['node.state'].sudo().search([('model_id', '=', rec.model_id.id),('is_workflow', '=', False)])
nodes.sudo().unlink()
def unlink(self):
for rec in self:
rec.unlink_nodes()
return super(BaseDashboard, self).unlink()
@api.constrains('action_id')
def _check_action_id(self):
@ -244,7 +256,7 @@ class BaseDashboard(models.Model):
stage = self.env['node.state'].create({'model_id':rec.model_id.id , 'form_view_id':rec.form_view_id.id , 'list_view_id':rec.list_view_id.id , 'action_id':rec.action_id.id,'stage_id':rel.id ,'name':rel.name,'is_holiday_workflow':True})
else:
self.update_selection()
self.update_selection()
if 'state' in model._fields and rec.model_name != 'hr.holidays' :
if not current_model:
@ -281,7 +293,8 @@ class BaseDashboardUser(models.Model):
)
board_id = fields.Many2one(
string='Bord',
comodel_name='base.dashbord'
comodel_name='base.dashbord',
ondelete = 'cascade'
)
state_id = fields.Many2one(

View File

@ -31,7 +31,11 @@
<page name="Apply TO" string="Apply TO">
<button name="compute_selection" string="Load Model State" type="object" class="oe_highlight" attrs="{'invisible': [('is_button', '=', True)]}"/>
<button name="update_selection" string="Updtae Model State" type="object" class="oe_highlight" attrs="{'invisible': [('is_button', '=', False)]}"/>
<div>
<button name="update_selection" string="Updtae Model State" type="object" class="oe_highlight oe_inline" attrs="{'invisible': [('is_button', '=', False)]}"/>
<span style="margin-left: 10px;"/>
<button name="unlink_nodes" string="Unlink Nodes" type="object" class="btn btn-danger oe_inline" attrs="{'invisible': [('is_button', '=', False)]}"/>
</div>
<field name="line_ids" attrs="{'invisible': [('is_button', '=', False)]}" context="{'default_model_name':model_name,'default_model_id':model_id}">
<tree editable="bottom">
<field name="sequence" widget="handle" />