<odoo>
    <data>

        <!-- Main Form View -->
        <record id="view_sos_fir_form" model="ir.ui.view">
            <field name="name">sos.fir.form</field>
            <field name="model">sos_fir</field>
            <field name="arch" type="xml">
                <form string="Final Inspection Report">
                <header>
                                    <button class="btn btn-primary" type="object"
                            name="action_report_fir_btn"><i class="fa fa-print"></i> Generate Report</button>
                    </header>
                    <sheet>
                    <group>
                        <group>
                            <field name="fir_no"/>
                            <field name="fir_date"/>
                            <field name="plan_ref_no"/>
                            <field name="fg_name" widget="many2many_tags"/>
                            <field name="product_type"/>
                            
                            
                            </group>
                            <group>
                            <field name="customer_name"/>
                            <field name="batch_No"/>
                            <!-- <field name="serial_no"/> -->
                            <field name="mfg_date"/>
                            <field name="sampling_size"/>
                            <field name="remarks"/>
                        </group>
                        </group>
    <notebook>
    <page string="Summary Report">
    <group>
    <field name="batch_size"/>
    </group>
    <group>
    <field name="approved_qty"/>
    </group>
    <group>
    <field name="rejected_qty"/>
    </group>
    <group>
    <field name="rejection_percentage_display"/>
    </group>
    <group>
    <field name="ncmr_ref" invisible="ncmr_ref == False" readonly="1"/>
    </group>

    </page>
 <page string="Rejection Details" invisible="rejected_qty &lt;= 0">


        <field name="rejected_line_ids">
    <tree editable="bottom" delete="false">
<field name="available_fg_names" column_invisible="1"/>
<field name="fg_name" domain="[('id', 'in', available_fg_names)]"/>
<field name="quantity"/>
</tree>
    </field>
    </page>
      <page string="Serial No's">
      <table class="table_custom">
      <thead><tr><td colspan="3"><b>Parse Serial No's</b></td></tr></thead>
      <tr><td colspan="3"><field name="serial_no_parse"/></td><td><button type="object" name="parse_serial_nos" class="btn btn-primary" string="Parse"></button></td></tr>
      </table>
      <br></br>
      
      
                                <field name="serial_no_line_ids">
                                    <tree editable="bottom">
                                        <field name="serial_no"/>
                                        <field name="inspection_decision"/>
                                    </tree>
                                </field>
                            </page>
    <page string="Inspection Remarks">
    <field name="testing_parameter_line_ids">
    <tree editable="bottom">
    <field name="testing_parameter"/>
    <field name="specification"/>
    <field name="results"/>
    <field name="sampled_qty"/>
    <field name="accepted_qty"/>
    <field name="rejected_qty"/>
    <field name="inspection_decision"/>
    </tree>
    </field>
    </page>
    <!-- Calibration Line Items -->

    <page string="MME">
    <field name="calibration_line_ids">
    <tree editable="bottom">
    <field name="calibration_device"/>
    <field name="identification_No"/>
    <field name="certification_No"/>
    <field name="calibrated_date"/>
    <field name="due_date"/>
    </tree>
    </field>
    </page>
    <page string="Rework History">
    <group>
    <field name="reworked_count"/>
    </group>
    <br></br>
    <hr></hr>
    </page>
    <page string="Test Log">
    <field name="test_log" filename="test_log_filename"/>
    <field name="test_log_filename" invisible="1"/>
    <br></br>
    <hr></hr>
    </page>
    <page string="SD Card Data">
    <field name="sd_card_data" filename="sd_card_data_filename"/>
    <field name="sd_card_data_filename" invisible="1"/>
    <br></br>
    <hr></hr>
    </page>
    <page string="Cloud Data">
    <field name="cloud_data" filename="cloud_data_filename"/>
    <field name="cloud_data_filename" invisible="1"/>
    <br></br>
    <hr></hr>
    </page>
    <page string="Firmware Data">
    <field name="firmware_data" filename="firmware_data_filename"/>
    <field name="firmware_data_filename" invisible="1"/>
    <br></br>
    <hr></hr>
    </page>
    </notebook>
    <templates>

<div class="row">
<div class="col-4">
    <!-- First Table -->
   <table class="table_custom" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;">

        <tr style="border-bottom: solid 1px #ccc;">
            <td style="padding: 8px;" class="column"><b>QC In-Charge</b>
            <br></br><br></br>
                <button string="Approve" invisible="qc_by_image" class="btn-primary custom_btn" type="object" name="action_qc_esign_btn"></button>
            </td>
            <td><field name="qc_by_image" widget="image"/></td>
        </tr>
        <tr invisible="qc_by_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="qc_tested_on" readonly="1"/></td>
        </tr>
        <tr invisible="qc_by_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="qc_by_name" readonly="1"/></td>
        </tr>
    </table>
    </div>
    <div class="col-4">
   <table class="table_custom" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;">

        <tr style="border-bottom: solid 1px #ccc;">
            <td style="padding: 8px;" class="column"><b>QA In-Charge</b>
            <br></br><br></br>
                <button string="Approve" invisible="qa_by_image" class="btn-primary custom_btn" type="object" name="action_qa_esign_btn"></button>
            </td>
            <td><field name="qa_by_image" widget="image"/></td>
        </tr>
        <tr invisible="qa_by_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="qa_tested_on" readonly="1"/></td>
        </tr>
        <tr invisible="qa_by_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="qa_by_name" readonly="1"/></td>
        </tr>
    </table>
</div>
<div class="col-4">
<table class="table_custom" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;">        <tr style="border-bottom: solid 1px #ccc;">
            <td style="padding: 8px;" class="column"><b>Stores In-Charge</b>
            <br></br><br></br>
                <button string="Approve" invisible="stores_received_image" class="btn-primary custom_btn" type="object" name="action_stores_esign_btn"></button>
            </td>
            <td><field name="stores_received_image" widget="image"/></td>
        </tr>
        <tr invisible="stores_received_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="stores_received_on" readonly="1"/></td>
        </tr>
        <tr invisible="stores_received_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="stores_received_by" readonly="1"/></td>
        </tr>
    </table>
</div>
</div>
</templates>
                    </sheet>
                </form>
            </field>
        </record>

        <!-- Tree View for sos_fir -->
        <record id="view_sos_fir_tree" model="ir.ui.view">
            <field name="name">sos.fir.tree</field>
            <field name="model">sos_fir</field>
            <field name="arch" type="xml">
                <tree string="Final Inspection Report">
                    <field name="fir_no"/>
                    <field name="fir_date"/>
                    <field name="customer_name"/>
                    <field name="product_type"/>
                         <field name="qc_by_name"  string="QC Tested By" widget="many2one_avatar_user"/>
            <field name="qa_by_name"  string="QA Approved By" widget="many2one_avatar_user"/>
            <field name="stores_received_by"  string="Stores Received By" widget="many2one_avatar_user"/>
            <field name="write_uid" string="Last Edited By" optional="hide"/>
                <field name="write_date" string="Last Edited On" optional="hide"/>
       
                </tree>
            </field>
        </record>

        <!-- Action for the model sos_fir -->
        <record id="action_sos_fir" model="ir.actions.act_window">
            <field name="name">Final Inspection Report</field>
            <field name="res_model">sos_fir</field>
            <field name="view_mode">tree,form</field>
            <field name="help" type="html">
                <p class="o_view_nocontent_smiling_face">
                    Create a New FIR
                </p>
            </field>
        </record>
<record id="sos_fir_view_panel" model="ir.ui.view">
<field name="name">sos_fir.search</field>
<field name="model">sos_fir</field>
<field name="arch" type="xml">
<search position="inside">
<field name="fir_no" string="FIR No"/>

<field name="customer_name" string="Customer Name"/>

</search>

</field>
</record>
        <!-- Menuitem -->
        <menuitem id="menu_sos_fir" sequence="5" name="Final Inspection Report (FIR)" parent="mop_forms_menu_root" action="action_sos_fir" groups="sos_inventory.sos_healthcare_user,sos_inventory.sos_scg_group_user,sos_inventory.sos_qc_user,sos_inventory.sos_management_user,sos_inventory.sos_ce_user"/>

    </data>
</odoo>
