from odoo import models, fields,api

class SOS_Material_Bom(models.Model):
    _name = 'sos_material_bom'
    _description = 'Material BOM'

    name = fields.Char(string="BOM Name", required=True)
    line_ids = fields.One2many('sos_material_bom_line', 'group_id', string="Materials", ondelete='cascade')

class SOS_Material_Bom_Line(models.Model):
    _name = 'sos_material_bom_line'
    _description = 'Material BOM Line'

    group_id = fields.Many2one('sos_material_bom', string="Material BOM", ondelete="cascade")
    component_id = fields.Many2one('sos_material', string="Materials", required=True)
    quantity = fields.Integer(string="Quantity", required=True, default=1)
