This question has been flagged
2418 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

Avatar
Discard