Odoo Help


How may I integrate "Note" module with Contacts like "Opportunities/SalesOrder/Meeting"Regards

on 2/10/16, 9:15 AM 940 views

 am trying to trickle up the "Note" module with the Contacts and for that I have created a xml file which have a button box just like "Opportunities/SalesOrder/Meeting" in "Contacts" form view.

Here is my Code

<record id="res_partner_view_button" model="ir.ui.view">

     <field name="name">res.partner.view.buttons</field

    <field name="model">res.partner</field

    <field name="inherit_id" ref="base.view_partner_form"></field

    <field name="priority" eval="20"/>

    <field name="arch" type="xml"/>

      <div name="button_box" position="inside">

     <button class="oe_stat button" type="action" name="%(note.action_note_note)d" attrs="{'invisible':[('customer','=',False)]}"

    <field string="Notes" name="x_note_count" widgrt="statinfo"/>


If I click onto my button box which is Called "Notes" it'll redirect me to the "Notes" kanban view,Which is fine for me.

But now I want exactly the same thing like "Sales/Opportunities". Eg:- If I click onto the "Notes" button  from  one particular Contact("ABC Company") it'll show me the list of Notes of "ABC Company" or that Particular Contact.


Axel Mendoza

--Axel Mendoza--
| 7 8 8
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
On 2/10/16, 10:19 AM

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

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 E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 2/10/16, 9:15 AM
Seen: 940 times
Last updated: 2/10/16, 10:19 AM