[Python] How to display inactive inherit_children_ids lines in ir.ui.view's form?

Discussão em 'Python' iniciado por Stack, Agosto 4, 2025.

  1. Stack

    Stack Membro Participativo

    In the model ir.ui.view in odoo 18, i want to get the inactive lines of the one2Many-field: inherit_children_ids as permanently displayed.

    I have tried to customize using a custom module (see below) but it does not change anything: the inactive line of inherit_children_ids disappears after having clicked on the Save button of the current (parent) view.

    # -*- coding: utf-8 -*-
    from odoo import api, fields, models, tools

    class IrUiViewZsb(models.Model):
    _inherit = 'ir.ui.view'

    # override from addon : base>ir_ui_view.py: add domain="[('active', 'in', [False,True])]"
    inherit_children_ids = fields.One2many('ir.ui.view', 'inherit_id', domain="[('active', 'in', [False,True])]", string='Views which inherit from this one')

    # override active = True from addon : base>ir_ui_view.py
    @api.model
    def _get_inheriting_views_domain(self):
    """ Return a domain to filter the sub-views to inherit from. """
    return [('active', 'in', [False,True])]



    I have tried another approach by extending the xml view ("base.view_view_form") using domain and context but it does not help neither:

    <field name="inherit_children_ids" position="attributes">
    <attribute name="domain">[]</attribute>
    <attribute name="context">{'active_test': False}</attribute>
    </field>



    [​IMG]

    Continue reading...

Compartilhe esta Página