Reputation: 31
Please, i want to put a value of a function in a field. my function return different results thats why i made :
def create(self, cr, uid, vals, context=None):
return {'value': {'field': value}}
But nothing happened.
Upvotes: 0
Views: 4619
Reputation: 1
def create(self, cr, uid, vals, context=None):
### here you can change the value of the fields
vals.update({'field': value})
## then call the super method
return super(class_name, self).create(cr, uid, vals, context=context)
Upvotes: 0
Reputation: 1
If you are using the 8/9 API
@api.model
def create(self,values):
values.update({'field_name': value})
## then call the super method
return super(ClassName, self).create(values)
Upvotes: 0
Reputation: 14746
You need to override create method and then super method calling required.
def create(self, cr, uid, vals, context=None):
### here you can change the value of the fields
vals.update({'field': value})
## then call the super method
return super(class_name, self).create(cr, uid, vals, context=context)
Upvotes: 1
Reputation: 1668
If you pass a value like a parameter: 'vals'
OpenERP v7,
def create(self, cr, uid, vals, context=None):
return {'value': {'your_field_name': vals }}
Odoo(OpenERP v8)
def create(self,vals):
return {'value': {'your_field_name': vals }}
I hope this can help you!
Upvotes: 1