Odoo Help

Welcome!

This community 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.

0

Multiple list views in different tabs

By
Anthony Gardiner
on 4/1/15, 1:53 PM 647 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')

}

 

2

Anil R. Kesariya

--Anil R. Kesariya--
4321
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
-
Technical & Functional Expert
Anil R. Kesariya
On 4/1/15, 11:17 PM

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




0
Anthony Gardiner
On 4/2/15, 7:39 PM

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


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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 4/1/15, 1:53 PM
Seen: 647 times
Last updated: 4/2/15, 7:41 PM