Skip to content

[17.0] l10n_es_partner: v17.0.1.0.7 - Error entering contacts #4895

@Tomero-Dev

Description

@Tomero-Dev

Module

l10n_es_partner

Describe the bug

Incompatibility with the base_search_custom_field_filter module.

To Reproduce

Create a custom filter field for the res.partner model
Image
Now, with the new version of the l10n_es_partner module, if we go to contacts it gives an error because it is not a str.

OCA/l10n-spain/l10n_es_partner/models/res_partner.py", line 75, in get_views
    res["views"]["search"]["arch"] = res["views"]["search"]["arch"].replace(
TypeError: a bytes-like object is required, not 'str'

This is because the base_search_custom_field_filter module returns the search view encoded in base64 instead of str, resulting in an error in the replace() function.

    @api.model
    def get_views(self, views, options=None):
        res = super().get_views(views, options)
        # Inject the commercial field into the domain when searching by complete_name
        if "search" in res["views"]:
            res["views"]["search"]["arch"] = res["views"]["search"]["arch"].replace(
                "'|', ('complete_name', 'ilike', self)",
                "'|','|',('complete_name','ilike',self),('comercial','ilike',self)",
            )
        return res

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions