Skip to Content
Menu
This question has been flagged
2 Replies
5275 Views

I am trying to show multiple tabs in my custom module, I have created the tabs and have one functioning correctly. When I attempt to replicate by simple copy paste it stops the server, clearly I am making a mistake, can some one assist me where:) Thanks

I start with this

'TagCustAL36': fields.float('Total Liabilities'),

'TagCustList01': fields.one2many('crm.lead.tag_cust_list_1', 'tag_list1_id', 'TagListA01')

}

class tag_cust_list_1(osv.osv):

_name = "crm.lead.tag_cust_list_1"

_columns = {

'tag_list1_id': fields.many2one('crm.lead','Member Block Reference', required=True, readonly=True),

'TagList01': fields.char('Name'),

'TagList02': fields.char('Address'),

'TagList03': fields.char('Contact'),

'TagList04': fields.char('Phone'),

'TagList05': fields.char('Details'),

'TagList06': fields.float('Price')

}


I am attempting this



'TagCustAL36': fields.float('Total Liabilities'),

'TagCustList01': fields.one2many('crm.lead.tag_cust_list_1', 'tag_list1_id', 'TagListA01'),

'TagCustList02': fields.one2many('crm.lead.tag_cust_list_2', 'tag_list2_id', 'TagListA02')

}

class tag_cust_list_1(osv.osv):

_name = "crm.lead.tag_cust_list_1"

_columns = {

'tag_list1_id': fields.many2one('crm.lead','Member Block Reference', required=True, readonly=True),

'TagList01': fields.char('Name'),

'TagList02': fields.char('Address'),

'TagList03': fields.char('Contact'),

'TagList04': fields.char('Phone'),

'TagList05': fields.char('Details'),

'TagList06': fields.float('Price')

}

}

class tag_cust_list_2(osv.osv):

_name = "crm.lead.tag_cust_list_2"

_columns = {

'tag_list2_id': fields.many2one('crm.lead','Member Block Reference', required=True, readonly=True),

'TagList01': fields.char('Name'),

'TagList02': fields.char('Address'),

'TagList03': fields.char('Contact'),

'TagList04': fields.char('Phone'),

'TagList05': fields.char('Details'),

'TagList06': fields.float('Price')

}

 

Avatar
Discard
Best Answer

Hello Anthony Gardiner,

If you are using the same information of data than you don't need to duplicate the relational model just create new field on your parent model with the same name.

Here you Go!

Let me correct your code if i am not mistaken to understand your question.

This is your parent model you can use the same child model for number of times with different field name.


    class crm_lead(osv.Model):

        _inherit = "crm.lead"

        _columns = {

            'TagCustAL36': fields.float('Total Liabilities'),

           'TagCustList01': fields.one2many('crm.lead.tag_cust_list_1', 'tag_list1_id', 'TagListA01'),

           'TagCustList02': fields.one2many(''crm.lead.tag_cust_list_1', 'tag_list2_id', 'TagListA02'),

           'TagCustList03': fields.one2many(''crm.lead.tag_cust_list_1', 'tag_list3_id', 'TagListA03') ,

           ......

           'TagCustList0N': fields.one2many(''crm.lead.tag_cust_list_1', 'tag_listN_id', 'TagListA0N') ,

    }

Here is the relational table.

    class tag_cust_list_1(osv.Model):

        _name = "crm.lead.tag_cust_list_1"

        _columns = {

           'tag_list1_id': fields.many2one('crm.lead','Member Block Reference', required=True, readonly=True),

           'tag_list2_id': fields.many2one('crm.lead','Member Block Reference', required=True, readonly=True),

           'tag_list3_id': fields.many2one('crm.lead','Member Block Reference', required=True, readonly=True),

           'tag_listN_id': fields.many2one('crm.lead','Member Block Reference', required=True, readonly=True),

           'TagList01': fields.char('Name'),

           'TagList02': fields.char('Address'),

           'TagList03': fields.char('Contact'),

          'TagList04': fields.char('Phone'),

          'TagList05': fields.char('Details'),

          'TagList06': fields.float('Price')

}

Hope this will help you.


Regards,

Anil




Avatar
Discard
Author Best Answer

Hello Amil,

Your answer was very much appreciated, it took me some time to get back to my computer and slowly implement with success. very much appreciated


Avatar
Discard
Related Posts Replies Views Activity
2
Oct 23
512
0
Oct 21
884
0
Aug 15
2245
3
Jun 15
6636
1
Mar 15
7688