Hi there,
My doubt is the following:
I want to add fields to the resource.resource model, so , as I learnt, I have to inherit from resource with the parameters set as below:
_name = 'resource.resource'
_inherit = 'resource.resource'
Then add the fields I want in the _columns parameter.
Until here everything is ok, but then I have some issues I don't know how to solve:
Where should I write the new class? Inside resource.py? or should I write a new .py (for example: resource2.py)
If I should write a new .py, where should I save it? Inside the resource folder? or in a custom folder? and besides, do I need some imports?
Any other recommendations are welcomed.
Thanks in advance
Code:
class resource_resource(osv.Model):
_name = 'resource.resource'
_inherit = 'resource.resource'
_columns = {
'name' : fields.function(_get_full_name, type='text', 'Full Name'),
'x_name' : fields.text('Name'),
'x_sname' : fields.text('Surname'),
}
def _get_full_name(self,cr,uid,ids,field,arg,context=None):
aResource = self.browse(cr,uid,ids)
return (aResource.x_name + ' ' + aResource.x_sname)
Openerp version: 7
Can u paste your code ?
Hi, I will edit my post with the code though my question is not about the code itself but more related to where should I put it.