tag:blogger.com,1999:blog-7549196375849659608.post5289422753416703817..comments2024-02-05T15:11:21.098+05:30Comments on Odoo Apps Development Technical Blog: Odoo/OpenERP : _rec_name and name_get()Shiv Modihttp://www.blogger.com/profile/05149017490048981686noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-7549196375849659608.post-74259170380381027842019-03-25T09:29:31.383+05:302019-03-25T09:29:31.383+05:30 Please share me , How to use _rec_name . I don`t ... Please share me , How to use _rec_name . I don`t understandThura Tunhttps://www.blogger.com/profile/17644883575739811647noreply@blogger.comtag:blogger.com,1999:blog-7549196375849659608.post-14989493815394485642017-01-20T23:17:22.773+05:302017-01-20T23:17:22.773+05:30Hi Friends,
I have another doubt here.I want to kn...Hi Friends,<br />I have another doubt here.I want to know the way to find which field is applied in _rec_name in the particular model.<br /><br />I have taken that model id from ir.model table and also I could find all the fields list created in that model through ir.model.fields table.But I could not find which field is used in _rec_name?<br /><br />Could you please help me?Anonymoushttps://www.blogger.com/profile/06313199228318085697noreply@blogger.comtag:blogger.com,1999:blog-7549196375849659608.post-1073916823467478702016-07-07T14:57:43.023+05:302016-07-07T14:57:43.023+05:30For searching, we created a stored computed field ...For searching, we created a stored computed field called 'display_name'. Then set it as the 'rec_name'.<br />Benefit of searching both name and code at once.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7549196375849659608.post-59779570460563150482015-11-20T10:24:58.455+05:302015-11-20T10:24:58.455+05:30somewhat same problem as thomas, not able to searc...somewhat same problem as thomas, not able to search (all hierarchy are listed)<br />def name_get(self, cr, uid, ids, context=None):<br /> if not ids:<br /> return []<br /><br /> self._rec_name = 'hierarchy'<br /><br /> res = []<br /> obj = self.pool.get('soldier2ndlife.product.categories')<br /> ids = obj.search(cr, uid, [('hierarchy', '!=', '')], context=context)<br /><br /> for r in self.read(cr, uid, ids, ['id', 'hierarchy'], context):<br /> res.append((r['id'], r['hierarchy'])) # append the tuple in the list res<br /><br /> return resAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7549196375849659608.post-72873318861842035882015-06-25T11:42:49.610+05:302015-06-25T11:42:49.610+05:30Let me try...Let me try...Shiv Modihttps://www.blogger.com/profile/05149017490048981686noreply@blogger.comtag:blogger.com,1999:blog-7549196375849659608.post-82282031877114316492015-06-25T03:48:47.733+05:302015-06-25T03:48:47.733+05:30Hi,
do you have any idea how to solve this?
http:/...Hi,<br />do you have any idea how to solve this?<br />http://stackoverflow.com/questions/31038103/odoo-8-howto-add-product-template-attribute-to-product-product-name-get<br />It's a similar occasion...Thomas Klosinskyhttp://designcomplex.denoreply@blogger.comtag:blogger.com,1999:blog-7549196375849659608.post-40238138286949057502015-04-17T00:29:41.905+05:302015-04-17T00:29:41.905+05:30I think you have to set just
_rec_name = ‘emp_co...I think you have to set just <br /><br />_rec_name = ‘emp_code’<br /><br />as well.Shiv Modihttps://www.blogger.com/profile/05149017490048981686noreply@blogger.comtag:blogger.com,1999:blog-7549196375849659608.post-17024036390630174432015-04-16T11:37:40.080+05:302015-04-16T11:37:40.080+05:30Hi overridden the name_get() method and i am showi...Hi overridden the name_get() method and i am showing the combination of emp name and code in the many2one dropdown. now the thing is i want to search the emp with emp code . If i try to search with emp name all names are listing but if i try to search with emp code it is showing create button to create the record. Please give me the solution for this.<br /><br />Thanks in advance.Anonymoushttps://www.blogger.com/profile/03230614649742576821noreply@blogger.com