<?xml version="1.0" encoding="UTF-8"?>
<odoo>
 <record id="action_aodr_form_list" model="ir.actions.act_window">
    <field name="name">ACCEPT ON-DEVIATION RECORD</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">sos_aodr</field>
    <field name="view_mode">tree,form,kanban</field>
</record>
    <record id="sos_aodr_view_tree" model="ir.ui.view">
        <field name="name">sos_aodr.view.tree</field>
        <field name="model">sos_aodr</field>
        <field name="arch" type="xml">
            <tree>
                
                <field name="aodr_no"/>
                 <field name="aodr_date"/>
                 <field name="write_uid" string="Last Edited By" optional="hide"/>
                <field name="write_date" string="Last Edited On" optional="hide"/>

            </tree>
        </field>
    </record>

<record id="sos_aodr_form_view" model="ir.ui.view">
<field name="name">Form</field>
<field name="model">sos_aodr</field>
<field name="arch" type="xml">
<form string="Model Form">
<header>
<button class="btn btn-primary" type="object"
        name="action_report_aodr_btn"><i class="fa fa-print"></i> Print</button>     
</header>
<sheet>
<h2 style="text-align: center;text-transform: uppercase;text-shadow: 1px 1p 1px #140718;color: #65407c;padding:5px;">Accept On-Deviation Record</h2><hr></hr><br></br>  
<group>
<group>
<field name="aodr_no"/>
<field name="source_of_deviation" widget="many2many_tag"/>
<field name="qp_no"/>
<field name="doc_ref_no"/>    
</group>
<group>
<field name="aodr_date"/>
<field name="fg_name"/>
<field name="batch_no"/>
</group>
</group>
<br></br>
<br></br>
<field name="identified_by" invisible="1"/>
<field name="reviewed_by" invisible="1"/>
<field name="approval_name" invisible="1"/>
<templates>
<table class="table_custom">
<tr><td class="column">Description Of Cause of the Problem</td><td class="column">Signature</td></tr>
<tr><td><field name="problem_cause"/></td>
 <td><button  string="E-Sign"  invisible="identified_by" class="btn-primary custom_btn" type="object" name="identified_by_sign_btn"></button>
 <field name="identified_sign_image" widget="image"/></td></tr>
</table>
<br></br>
<br></br>
<table class="table_custom">
<tr><td class="column">Comments By the Reviewer</td><td class="column">Signature</td></tr>
<tr><td><field name="reviewer_comments"/></td>
 <td><button  string="E-Sign"  invisible="reviewed_by" class="btn-primary custom_btn" type="object" name="reviewed_by_sign_btn"></button>
 <field name="reviewer_sign_image" widget="image"/></td></tr>
</table>
<br></br>
<br></br>
 <div style="width: 100%; text-align: right;">
<table style="color: #000;background-color: #fff;width: 50%; display: inline-table; border: solid 1px #ccc;">
<tr>
<td style="padding: 8px;" class="column"><b>Authorised Signatory</b></td>
<td> <button  string="Approve"  invisible="approval_name" class="btn-primary custom_btn" type="object" name="approved_by_sign_btn"></button>
</td>
<td><field name="approval_image" widget="image"/></td>
</tr>
</table>
</div>
</templates>
</sheet>
</form>
</field>
</record>

<menuitem id="aodr_menu"
              name="Accept On-Deviation Record (AODR)"
              parent="cnp_forms_menu_root" action="action_aodr_form_list" groups="sos_inventory.sos_healthcare_user,sos_inventory.sos_qc_user,sos_inventory.sos_management_user"/>

</odoo>
