Wednesday, August 21, 2019

default field value from xml in odoo

ODOO



to explain it , Let us say we have selection field type which is has two selection values "in , out " as bellow 

type = fields.Selection([('in','In'),('out','Out'), string="Type"])

 and we want to make it's default value "in" from xml , so when we create our view we can pass the default value "in" with context as bellow 

<record id="view_id_form" model="ir.ui.view">
            <field name="name">model.model.form</field>
            <field name="model">
model.model</field>
            <field name="context">{'default_type':'in'}</field>
            <field name="arch" type="xml"> 
            <form>

No comments:

Post a Comment

Odoo Invoice Qr code issues

There are two main issues must of us facing with the QR code in Odoo invoice & these issues are 1/ QR code displayed as broken image w...