Odoo Help


How to add functionality to my plugin?

on 7/17/14, 3:38 AM 648 views

Hello everyone. I'm writing an OpenErp feedback module and i would like to add some functionality to it, but I don't know how to do it.


This is the main source code:


from osv import fields, osv
from openerp.addons.crm import crm
from openerp.addons import project

def _contract_get(self, cr, uid, context=None):
    cr.execute("select code,name from account_analytic_account where code is not null")
    return cr.fetchall()

class support_form(osv.osv):
    _name = "cf.support"
    _description = 'Formview Module'
    _columns = {
        'created_by' : fields.many2one('res.users', 'Author', readonly=True),
        'name': fields.char('Name', required=True),
        'status': fields.selection(crm.AVAILABLE_STATES, 'Status', select=True),
        'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True),
        'description': fields.text('Description'),
        'private': fields.boolean('Private'),
        'contract': fields.selection(_contract_get, 'Contract'),
        'user_id': fields.many2many('res.users'),
        'comments' : fields.many2many('cf.comments'),

    _defaults = {
        'status': crm.AVAILABLE_STATES[0][0],
        'priority': crm.AVAILABLE_PRIORITIES[2][0],
        'created_by': lambda obj, cr, uid, context: uid,

class cf_comments(osv.osv):
    _name = "cf.comments"
    _description = "Comments for cf_support module"
    _columns = {
        'comments' : fields.text('comments')


and this is the xml view:



<openerp> <data>
<record model="ir.ui.view" id="cf_support">
        <field name="name">cf.support</field>
        <field name="model">cf.support</field>
        <field name="arch" type="xml">
            <form string="Form" version="7.0">
                <tree string='cf_admin'>
                        <field name="created_by" />
                        <field name="name" string='Title'/>
                        <field name="status" />
                        <field name="private" string="Private (Visible only for author and admins)"/>
                        <field name="priority" />
                        <field name="contract" />
                        <field name="user_id" string='Assigned Users' widget="many2many_tags" />
                        <field name="comments" string='comments' />
                <field name="description" widget="html" />

    <record model="ir.ui.view" id="from_view_tree">
        <field name="name">cf.support</field>
        <field name="model">cf.support</field>
        <field name="arch" type="xml">
            <tree string="Form">
                <field name="name" />

    <record model='ir.actions.act_window' id='form_view_action'>
        <field name="name">Form</field>
        <field name="res_model">cf.support</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="context">{}</field>
        <field name="help" type="html">
          <p class="oe_view_nocontent_create">
                Click to create a new record.
            <p>This is a test class</p>

    <menuitem id="myform_ID" name="cf support" />

    <menuitem id="myform_menu_ID" name="cf_support" parent="myform_ID"  />

    <menuitem id="myform_menu2_ID" name="support" parent="myform_menu_ID"  action='form_view_action' />




what I would like to add here:

1) If private button is presed, then to make this message visible only for admins and casted users ( throw user_id field ) 

2) To add a notification if a user is casted and receives a message throw this module

3) to make comments more beatifull. It will be excelent if they would be in the tree graph or something like that.


I don't expect that someone will do it for me. I'm asking for an advice. Thanks.


Your Answer

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.


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: 7/17/14, 3:38 AM
Seen: 648 times
Last updated: 3/16/15, 8:10 AM