Skip to Content
Menu
This question has been flagged
2 Replies
1447 Views

Hello I am using odoo13 and i have to make field date_done (labelled as Effective date which is only visible when delivery order is in done state) visible using my code , can somebody please help me out with this ?

Avatar
Discard

Hello akshat Dave

you have inherited form view and use <xpath> to bypass the invisible condition of base. for visible those fields.

Best Answer

Sometimes replacing a field is dangerous if that field is used in other modules in xpath.

The better option is to use "attributes" to change the attribute of the tag.

Ex:

field name="date_done" position="attributes">
    attribute name="string">Effective Date  attribute>
field>



Avatar
Discard

XML:
<field name="date_done" position="attributes">
<attribute name="string">Effective Date</attribute>
</field>

Author Best Answer

Hello Shaktisinh

I have defined the same field in the inherited model and gave <xpath> with position as replace and it worked for me .

class Picking(models.Model):
    _inherit = "stock.picking"

    date_done = fields.Datetime('Date of Transfer', copy=False, readonly=False, help="Date at which the transfer has been processed or cancelled.")



            <xpath expr="//field[@name='date_done']" position="replace">
                <field name="date_done" string="Effective Date"/>
            </xpath>


This is my code , It works properly and please do correct me if i am wrong or you have any other way.

Thank you for response

Avatar
Discard