Vauxoo / pylint-odoo

1 stars 4 forks source link

Duplicate fields #178

Closed imanie383 closed 1 year ago

imanie383 commented 3 years ago

We need a lint that validates duplicate fields, to avoid: image

imanie383 commented 3 years ago

@moylop260

moylop260 commented 2 years ago

@antonag32

In fact, it is done but it could require a fix

antonag32 commented 1 year ago

@moylop260 I think we can close this? XML files are no longer checked by pylint-odoo and we just did something related to this in oca hooks.

moylop260 commented 1 year ago

Totally agree!

I just added the following XML code in the test_repo:

        <record id="view partner form inherit" model="ir.ui.view">
            <field name="name">res.partner.form.inherit</field>
            <field name="model">res.partner</field>
            <field name="priority" eval="30"/>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="priority" eval="100"/>
            <field name="arch" type="xml">
                <xpath expr="//button[@name='toggle active']" position="before">
                    <button class="o stat button" name="action open duplicates" type="object" icon="fa-clone" string="Show duplicates"/>
                    <button class="o stat button" name="action open similar" type="object" icon="fa-clone" string="Show similar"/>
                </xpath>
            </field>
        </record>

After run the unittest the result was:

test_repo/broken_module/model_view_odoo2.xml:75 Duplicate xml field "priority" in lines 77 - [xml-duplicate-fields]

Screenshot 2022-11-09 at 14 51 44