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

Module: Survey answer generation

Entity: survey.user_input.line

Compute Method: _compute_diff_with_origin

Inputs Method Outputs
"""When two answers are linked the next survey question is prefilled. If the
        user changes the answer in the next survey we want to spot the difference"""
self.diff_with_origin = False
for line in self.filtered("origin_input_line"):
            if line.answer_type and line.answer_type != "suggestion":
                value = f"value_{line.answer_type}"
                previous_value = str(line.origin_input_line[value])
                current_value = str(line[value])
            else:
                current_value = line.suggested_answer_id.value
                previous_value = line.origin_input_line.suggested_answer_id.value
            if previous_value == current_value:
                continue
            line.diff_with_origin = get_diff(
                (previous_value, _("Previous")), (current_value, _("Current"))
            )

Back to entity