Hi ,I went to attribute a default value for many2one field but it does not work
def _default_location(self):
id_needed = self.env['stock.location'].search([('name','=','Clients')]).id
return id_needed
Thanks for your help
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi ,I went to attribute a default value for many2one field but it does not work
def _default_location(self):
id_needed = self.env['stock.location'].search([('name','=','Clients')]).id
return id_needed
Hello
look below code, may be this will helps you.
@api.model
def _default_location(self):
id_needed = self.env['stock.location'].search([('name','=','Clients'), ('usage', '=', 'internal')], limit=1)
return id_needed and id_needed.id or False
def _default_location(self):
id_needed = self.env['stock.location'].search([('name','=','Clients')]).id
return id_needed
Odoo Customization Tips: https://plus.google.com/collection/oW1DWE