Merge pull request #5007 from expsa/yt_dev_odex25_base
[FIX] system_dashboard_classic: FIX bug delete nodes
This commit is contained in:
commit
fa35a3309e
|
|
@ -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 "حذف المراحل"
|
||||
|
|
@ -75,6 +75,18 @@ class BaseDashboard(models.Model):
|
|||
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):
|
||||
for record in self:
|
||||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue