from odoo import fields, models class IfcBom(models.Model): _name = 'grt.ifc.bom' _description = 'IFC Bill of Materials' _order = 'level, parent_id, sequence, id' project_id = fields.Many2one('grt.ifc.project', string='Project', required=True, ondelete='cascade') ifc_key = fields.Char(string='IFC Key', required=True, index=True) name = fields.Char(string='Name', required=True) global_id = fields.Char(string='GlobalId', index=True) ifc_type = fields.Char(string='IFC Type', required=True, default='IfcProduct', index=True) parent_id = fields.Many2one('grt.ifc.bom', string='Parent Item', ondelete='cascade', index=True) child_ids = fields.One2many('grt.ifc.bom', 'parent_id', string='Child Items') relation_type = fields.Char(string='Relation Type', readonly=True) level = fields.Integer(string='Level', default=0, readonly=True) sequence = fields.Integer(string='Sequence', default=10) quantity = fields.Float(string='Quantity', digits=(16, 4), default=1.0) unit_name = fields.Char(string='Unit', default='ea')