Skip to Content
Menu
This question has been flagged
1 Reply
27005 Views

I am trying to make the default value for a checkbox "FALSE". When i type in false for the default value and try to create a new contact, the box is still checked and should not be. If there is anyone that can help me with this, it would be much appreciated. 

Avatar
Discard
Best Answer

HI,

Always the default value of the check box will be false. You are getting it as ticked/True due to  logical error that you had given in the default. To get default as False, just define the field like this,

field_name = fields.Boolean(string="check box")

Anyway if you want to assign False using default you can try like this,

field_name = fields.Boolean(string="check box", default=False)
Avatar
Discard

Hi Niyas, when you create a field from odoo's interface, is there a way to set default value from field?

Like this: https://ibb.co/CPm3BJQ

I have currently created some fields directly in Odoo and not from .py files, and hope to be able to change it to .py files soon, but at the moment I wish to create them with default values hopefully and not change context in action due to some updates means this change is lost and updated to default context from .py file of native modules (Using odoo Enterprise)

Hope it's understandable.

Thanks!