Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Delete one record ,I want to know here the usage of mapped..need a help.. what did this code exactly mainly
resources = self.mapped('resource_id')
This is what i am looking Tx STCKFLOW-
Basically it is a convenience method to return recordsets (lists of objects or values). Lets say you wanted a list of all partners email addresses matching a specific domain. You could easily accomplish this like so.
domain = [('email','not in',[False,None])] records = self.env['res.partner'].search(domain) email_list = records.mapped('email') print(email_list) >>> [firstname.lastname@example.org',email@example.com',firstname.lastname@example.org']
This way you do not need to do this
email_list =  domain = [('email','not in',[False,None])] for rec in self.env['res.partner'].search(domain): if rec.email: email_list.append(rec.email) print(email_list) >>> [email@example.com',firstname.lastname@example.org',email@example.com']
In the above example odoo would have iterated through all of the records and returned the email from each record in the form of a list.
So rather than looping through all records to obtain the same field from each record you can use mapped.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 9/25/17, 3:45 AM|
|Seen: 1685 times|
|Last updated: 1/12/18, 10:16 PM|