from odoo import models, fields, api

class SosReworkLog(models.Model):
    _name = 'sos_rework_log'
    _description = 'Rework Log'
    _rec_name = 'ncmr_no'

    ncmr_no = fields.Many2one('sos_ncmr', string="NCMR No")
    fptc_no = fields.Char(string="FPTC No.")
    product_name = fields.Char(string="Product Name")
    product_code = fields.Char(string="Product Code")
    product_sl_no_batch_code = fields.Char(string="Product Sl No. with Batch Code")
    date_time = fields.Datetime(string="Date & Time")
    rework_qty = fields.Integer(string="Rework Qty")
    status = fields.Selection([
        ('open', 'Open'),
        ('closed', 'Closed')
    ], string="Status", default='open')
    time_taken_rework = fields.Integer(string="Time Taken for Rework (in Mins)")
    component_replaced = fields.Char(string="Component Replaced")
    reason_replacement = fields.Selection([
        ('warranty', 'Warranty'),
        ('development', 'Development'),
        ('test', 'Test'),
        ('vendor', 'Vendor')
    ], string="Reason for Replacement")
    iteration_no = fields.Integer(string="Iteration No")
    fptcr_no = fields.Char(string="FPTCr No")
    remark = fields.Text(string="Remark")
