|
@ -35,7 +35,7 @@ class BaseAutomation(models.Model): |
|
|
def create_refresh_rules(self, model_name): |
|
|
def create_refresh_rules(self, model_name): |
|
|
model = self.env['ir.model'].search( |
|
|
model = self.env['ir.model'].search( |
|
|
[('model', '=', model_name)], limit=1) |
|
|
[('model', '=', model_name)], limit=1) |
|
|
if model_name in self.env and model.exists(): |
|
|
|
|
|
|
|
|
if model_name in self.env and len(model): |
|
|
triggers = [ |
|
|
triggers = [ |
|
|
('on_create', 'Creation'), |
|
|
('on_create', 'Creation'), |
|
|
('on_write', 'Update'), |
|
|
('on_write', 'Update'), |
|
@ -46,7 +46,7 @@ class BaseAutomation(models.Model): |
|
|
('model_id', '=', model.id), |
|
|
('model_id', '=', model.id), |
|
|
('trigger', '=', trigger[0]) |
|
|
('trigger', '=', trigger[0]) |
|
|
], limit=1) |
|
|
], limit=1) |
|
|
if refresh_rules.exists(): |
|
|
|
|
|
|
|
|
if len(refresh_rules) > 0: |
|
|
refresh_rules.write({ |
|
|
refresh_rules.write({ |
|
|
'active': True |
|
|
'active': True |
|
|
}) |
|
|
}) |
|
|