Hello All,
I want to set default country "Hong Kong" for country_id field. So what function i write for that in odoo10. Now my python code is below:
py code:
@api.depends('country_id')
def _get_default_country(self, context=None):
if self.country_id:
return {'domain': [('country_id', '=', self.country_id.id)]}
print "yes:", 235
return True
_defaults = {
'country_id': _get_default_country
}
country_info = fields.Char(compute='_get_default_country', string='Default Country')
For setting default value for a field from the user interface: https://www.youtube.com/watch?v=cQYHiGAd9k4