Odoo18-Base/extra-addons/marketing_automation_sms/models/marketing_trace.py
hoangvv b8024171a2 - add modules(marketing automation + approvals + webstudio) \n
- create new module hr_promote (depend: hr,approvals) \n
- customize approval_type (WIP)
2025-01-17 07:32:51 +07:00

26 lines
953 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
class MarketingTrace(models.Model):
_inherit = 'marketing.trace'
def process_event(self, action):
self.ensure_one()
super_result = super(MarketingTrace, self).process_event(action)
if super_result:
opened_child = self.child_ids.filtered(lambda trace: trace.state == 'scheduled')
if action == 'sms_click':
opened_child.filtered(
lambda trace: trace.activity_id.trigger_type == 'sms_not_click'
).action_cancel(message=_('Parent activity SMS clicked'))
elif action == 'sms_bounce':
opened_child.filtered(
lambda trace: trace.activity_id.trigger_type != 'sms_bounce'
).action_cancel(message=_('Parent activity SMS bounced'))
return super_result