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.
When user create a record, there are message at the bottom "Note by XXXX - xx:xx PM Partner Created".
How to call this function. Let say when user run workflow and move to another node at workflow, system will take note or give note.
Thanks and Regards,
1. Add a dependency for the module mail in __openerp__.py.
2. Inherit model mail.thread into your new model
_name = 'my.model'
_inherit = ['mail.thread']
3. Here you want to create the msg on changing states in a workflow. So call a python method from the node or workflow activity defined in the xml file.
4. In that python method, at the end, you can call message_post(), which will display the note.
For eg: Here am calling message_post() on record creation
def create(self, vals):
new_trip = super(my_model, self).create(vals)
5. To show the note area, you need add two fields from the mail.thread model in your form view like this:
<record model='ir.ui.view' id='my_model_form'>
<field name="arch" type="xml">
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
<field name="message_ids" widget="mail_thread"/>
Note: The above steps is to add the message feature to new models. For existing models like res.partner, sale.order etc mail.thread is already inherited, so no need to inherit again or add the fields in xml file. You just need to call the message_post(body="Your note") from your desired python method in your inherited class.
Hope this helps
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
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: 10/18/15, 10:16 AM|
|Seen: 333 times|
|Last updated: 1/29/17, 11:57 PM|