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

Module: Saudi Arabia - E-invoicing

Entity: l10n_sa_edi.document

Compute Method: _compute_resource

Inputs Method Outputs
"""
        Assign the field based on the res_model equivalent to:
        match record.res_model:
        case 'account_move':
            record.account_move_id = record.res_id
        case ...:
            ...
        record.write({
            'pos_order_id': False,
            ...
        })
        """
for record in self:
            field = self._l10n_sa_get_resource_field_mapping()[record.res_model]
            other_fields = set(self._l10n_sa_get_resource_field_mapping().values()) - {field}
            record[field] = record.res_id
            for field in other_fields:
                record[field] = False

Back to entity