Odoo Help

0

How can I add a field to a phonecall and the transient model opportunity2phonecall?

By
Nicolas Lopez
on 7/17/14, 11:22 AM 808 views

Hi All

I'm trying to add a new many2one field called "phonecall type" to the phonecalls, so far it's simple and I had no problems there. Now as it can be also generated from an opportunity, I've added the same relationship to the opportunity2phonecall transient model. The problem is that the phonecall is created from the wizard, but the relationship is not saved. If I create a phonecall directly, it works fine.

Here the code of my ultra-simple module:

The new class phonecall_type:

class crm_phonecall_type(osv.osv):
    _name = "crm.phonecall.type"
    _description = "Phonecall type"
    _order = "name"

    _columns = {
        'name': fields.char('Name', required=True, translate=True),
    }

Add the relationship to the phonecall:

class crm_phonecall(osv.osv):
    _inherit = "crm.phonecall"

    _columns = {
        'type_id': fields.many2one('crm.phonecall.type', string='Type',),
    }

Add the relationship to the opportunity2phonecall:

class crm_opportunity2phonecall(osv.TransientModel):
    _inherit = "crm.opportunity2phonecall"

    _columns = {
        'type_id': fields.many2one('crm.phonecall.type', string='Type',),
    }

 

Any ideas?

 

Thanks in advance,

 

Nicolas

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

Question tools

1 follower(s)

Stats

Asked: 7/17/14, 11:22 AM
Seen: 808 times
Last updated: 3/16/15, 8:10 AM