[FIX] odoo: fixes the error when deleting the worksheet template
Steps to reproduce : - install field service module - install industry_fsm_report bridge module - click on configuration - click on worksheet template - try to delete more than one record Issue: - error while deleting more than one record Cause: - because ,this issue is from base while deleting the model id's Solution: - if we write condition for filtering manual models and calling prepare_update() method and then non manual models ,then the issue will be solved task-3607053 closes odoo/odoo#144761 X-original-commit: 0d9d7e5fd944e3ef6e1c53d63a6aec61da51cbf5 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
This commit is contained in:
@@ -314,10 +314,9 @@ class IrModel(models.Model):
|
||||
|
||||
def unlink(self):
|
||||
# prevent screwing up fields that depend on these models' fields
|
||||
if self.state == 'manual':
|
||||
self.field_id.filtered(lambda f: f.state == 'manual')._prepare_update()
|
||||
else:
|
||||
self.field_id._prepare_update()
|
||||
manual_models = self.filtered(lambda model: model.state == 'manual')
|
||||
manual_models.field_id.filtered(lambda f: f.state == 'manual')._prepare_update()
|
||||
(self - manual_models).field_id._prepare_update()
|
||||
|
||||
# delete fields whose comodel is being removed
|
||||
self.env['ir.model.fields'].search([('relation', 'in', self.mapped('model'))]).unlink()
|
||||
|
||||
Reference in New Issue
Block a user