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.
I've been asked to develop a tag system for attachments.
While for attachments I've used the Document Management System module, I didn't find anything useful for tag management.
Thus, I've developed my own, custom module in which attachments (ir.attachment model) have been extended with a Many2many relation with a tag model, that in turn represents... a tag, and has a tag field representing the actual tag's textual content.
Then I've been struggling with search by tag...
The problem here is that the searched term has to be compared with a related object's fields (i.e. the tags), not with a field of the attachment itself.
So I came up with a workaround. I've extended the attachment model with:
a computed char field called tags with an associated custom search method _search_tags
a boolean field called found_by_tag
_search_tags is invoked each time a search is performed and its job is to set the flag found_by_tag to the proper value, based on the searched term.
Thus, the expression for the search view becomes [('found_by_tag', '=', True)].
Note: For the actual code, check this stack overflow question: http://stackoverflow.com/questions/34086330/odoo-implementing-a-tag-system-for-attachments
While the workaround actually works, I'm wondering if that's too much. Is there a simpler way to implement a search by tag? Or, alternatively, is there a module that may be used for this purpose?
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: 12/6/15, 6:03 AM|
|Seen: 571 times|
|Last updated: 12/6/15, 6:03 AM|