odoo / odoo

Odoo. Open Source Apps To Grow Your Business.
https://www.odoo.com
Other
38.83k stars 25.18k forks source link

[13.0] Wrong computation of tree view Header with conditional display buttons #39352

Closed OmniaGit closed 1 year ago

OmniaGit commented 5 years ago

Impacted versions: 13.0 Steps to reproduce: using a rule displayed button not present in the firs page make not visible the button switching the page. the header is set to 0 size as shown in video

Current behavior: button not displayed

Expected behavior: button must be displayed

Video/Screenshot link (optional): https://youtu.be/Dskt-S4xvcE

pedrobaeza commented 5 years ago

I don't really get the problem. Is this a custom development? If so, please put the code.

OmniaGit commented 5 years ago

Dear Pedro, The video it's quite clear. The tree view hide the entire column if you have a button hidden in the first pagination and shown in the second page.

Field definition:

def _related_doc_ids(self):
    for bom_line_brws in self:
            bom_line_brws.related_document_ids = bom_line_brws.product_id.linkeddocuments

def _related_boms(self):
    for bom_line in self:
        if not bom_line.product_id:
            bom_line.related_bom_ids = []
        else:
            bom_objs = self.env['mrp.bom'].search([
                    ('product_tmpl_id', '=', bom_line.product_id.product_tmpl_id.id),
                    ('type', '=', bom_line.type),
                    ('active', '=', True)
                ])
              bom_line.related_bom_ids = bom_objs

    related_bom_ids = fields.One2many(compute='_related_boms',
                                      comodel_name='mrp.bom',
                                      string='Related BOMs')
    related_document_ids = fields.One2many(compute='_related_doc_ids',
                                           comodel_name='ir.attachment',
                                           string='Related Documents')

xml view:

<xpath expr="//field[@name='bom_line_ids']/tree/field[@name='product_id']" position="before">
                <field name="related_bom_ids" invisible="True"/>
                <field name="hasChildBoms" invisible="False"/>
                <button name="openRelatedBoms"
                        type="object"
                        icon="fa-level-down" 
                        class="btn btn-sm oe_stat_button"
                        attrs="{'invisible':[('hasChildBoms', '=', False)]}"/>
                <field name="related_document_ids" invisible="True"/>
                <button name="openRelatedDocuments"
                        type="object"
                        icon="fa-folder-open"
                        class="btn btn-sm oe_stat_button"
                        attrs="{'invisible':[('related_document_ids', '=', [])]}"/>
            </xpath>

you can have a look at the full code at the following files: https://github.com/OmniaGit/odooplm/blob/13.0/plm/models/mrp_bom_line.py and https://github.com/OmniaGit/odooplm/blob/13.0/plm/views/mrp_extension.xml

pedrobaeza commented 5 years ago

Now it's clear. Let's see if this is fixable.

@ged-odoo something for your team.

C3POdoo commented 1 year ago

Dear @OmniaGit,

Thank you for your report but we are closing it due to inactivity. We apology if we could not look at your request in time. If your report still makes sense, don't hesitate to reopen a new one. We will try to check it as soon as possible.

This is an automated message.