Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Live Chat

Entity: chatbot.script.step

Compute Method: _compute_is_forward_operator_child

Inputs Method Outputs
parent_steps_by_chatbot = {}
for chatbot in self.chatbot_script_id:
            parent_steps_by_chatbot[chatbot.id] = chatbot.script_step_ids.filtered(
                lambda step: step.step_type in ["forward_operator", "question_selection"]
            ).sorted(lambda s: s.sequence, reverse=True)
for step in self:
            parent_steps = parent_steps_by_chatbot[step.chatbot_script_id.id].filtered(
                lambda s: s.sequence < step.sequence
            )
            parent = step
            while True:
                parent = parent._get_parent_step(parent_steps)
                if not parent or parent.step_type == "forward_operator":
                    break
            step.is_forward_operator_child = parent and parent.step_type == "forward_operator"

Back to entity