Odoo Help


1 Answer

Axel Mendoza

--Axel Mendoza--
| 8 8 10
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
10.02.16, 10:19

For that you need to have the button of type object that will execute the method defined in the model and specified in the name attribute of the button tag. In the method then you need to return the action dict with a domain to restrict the ids of the notes for the contact, like this:

<button class="oe_stat button" type="object" name="view_notes" attrs="{'invisible':[('customer','=',False)]}">
    <field string="Notes" name="x_note_count" widget="statinfo"/>

def view_notes(self, cr, uid, ids, context=None):

mod_obj = self.pool.get('ir.model.data')

result = mod_obj.get_object_reference(cr, uid, 'note', 'action_note_note')

id = result and result[1] or False

result = act_obj.read(cr, uid, [id], context=context)[0]

notes_ids = [note.id for note in self.browse(cr, uid, ids[0], context).notes_ids]

result['domain'] = "[('id','in',[" + ','.join(map(str, notes_ids)) + "])]"

return result

With that in place you only need to build the value of the list of notes_ids to filter all the notes to show only those related to the contact, I just put an example of how to do it

Ask a Question
Keep Informed
1 follower(s)
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.

Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now