I got an attributeError: 'list' object has no attribute 'filtered' when trying this code:
tag_ids = [self.env['account.analytic.tag'].browse(tag) for tag in analytic_tag[0][2]]
my_tag = tag_ids.filtered(lambda q: .....)
when printing tag_ids, I got: tag_ids:[account.analytic.tag(2,), account.analytic.tag(1,)]
How can I use filtered function in this case?
Thanks.
You get a list of single recordsets, instead of a multi recordset.
Just use the list comprehension another way:
tags = self.env['account.analytic.tag'].browse([tag_id for tag_id in analytic_tag[0][2]])
my_tags = tags.filtered()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.