Corey Huntley
Corey Huntley

Reputation: 101

Custom odoo module - how to make a table

I am creating a custom module with additional part numbers on a separate tab in the products screen. I have built the module, but am having trouble figuring out how to display the information so it matches the layout in the attached image. I have tried tree view but have not been able to get the fields on the same line. Can this only be accomplished through css or is there a table view that I am not aware of?

I also need to make sure that all of the information in row 1 stays tethered together for additional forms, etc. My plan is to make the field names for each row end with a different number (i.e. x_mfrname1,x_mfrpn1,x_mfrname2,x_mfrpn2, etc.). Can somebody please just tell me if I am on the right track. This is the initial Odoo setup for a client of mine and I don't want them to come back to me down the line and find out I forgot something. I have been scouring the internet and reading a few books but I am not completely confident.

Here is a link to a layout of what I am talking about: MFG Part Number Tab

Thanks!

Upvotes: 0

Views: 2241

Answers (1)

class sub_part_details(models.Model)
    _name='sub.part.detail'

    primary_pn=fields.Boolean('Primary P/N')
    obsolete=fields.Boolean('Obsolete')
    pn=fields.Char('P/N')
    desc=fields.Char('Description')
    upgrade=fields.Char('Upgrade')
    part_detail_id=fields.Many2one('part.details')

class part_details(models.Model)
    _name='part.details'

    cat=fields.Char('CAT')
    sub_ass=fields.Char('Subassembly')
    main_ass=fields.Char('Main Assembly')
    notes=fields.Text('Notes')
    sub_details_ids=fields.One2Many(''sub.part.detail','part_detail_id')

It might be helpful

Upvotes: 0

Related Questions