<?xml version="1.0" encoding="UTF-8"?>
<odoo>


 <record id="action_mon_form_list" model="ir.actions.act_window">
    <field name="name">Order Note</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">sos_mon</field>
    <field name="view_mode">tree,form,kanban</field>

</record>
<record id="sos_mon_view_panel" model="ir.ui.view">
<field name="name">sos_mon.search</field>
<field name="model">sos_mon</field>
<field name="arch" type="xml">
<search position="inside">

 <field name="mon_no" string="Order No"/>
<filter string="Archived" name="active" domain="[('active', '=',False)]"/>
</search>

</field>
</record>
    <record id="sos_mon_view_tree" model="ir.ui.view">
        <field name="name">sos_mon.view.tree</field>
        <field name="model">sos_mon</field>
        <field name="arch" type="xml">
            <tree>
            <field name="mon_no"/>
            <field name="mon_date"/>
             <field name="min_no" string="Issue Note Ref No" />
            <field name="purpose"/>
            <field name="approx_value" string="Order Value"  optional="hide"/>
            <field name="prepared_by_name" string="Prepared By" widget="many2one_avatar_user"/>
            <field name="dept_in_charge_name" string="Department In-Charge" widget="many2one_avatar_user"/>
            <field name="top_management_name" string="Top Management Approved By" widget="many2one_avatar_user"/>
            <field name="status" widget="badge" decoration-success="status == 'close'" decoration-danger="status == 'open'"/>
 <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_mon_form_view" model="ir.ui.view">
      <field name="name">Form</field>
        <field name="model">sos_mon</field>
        <field name="arch" type="xml">
<form string="Model Form">
<field name="prepared_by_name" invisible="1"/>
<field name="dept_in_charge_name" invisible="1"/>
<field name="top_management_name" invisible="1"/>
                              <header>
                    <button class="btn btn-primary" type="object"
                            name="action_report_mon_btn"><i class="fa fa-print"></i> Print</button>
                    <button groups="sos_inventory.sos_scg_group_user" class="btn btn-primary" type="object"
                            name="action_report_mon_items_btn"><i class="fa fa-print"></i> Items Print</button>
                 
                            
                </header>
                    <sheet>
                          <widget name="web_ribbon" text="Open" bg_color="bg-danger" invisible="status == 'close'"/>
      <widget name="web_ribbon" text="Closed" bg_color="bg-success" invisible="status == 'open'"/>
      
<h2 style="text-align: center;text-transform: uppercase;text-shadow: 1px 1p 1px #140718;color: #65407c;padding:5px;">Material / SFG / FG <br></br>Order Note</h2><hr></hr><br></br>  

<table class="table table" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;">
<tr><td><group><field name="material_option"/></group></td>
<td><group><field name="sfg_option"/></group></td>
<td><group><field name="fg_option"/></group></td></tr>
</table>
<br></br>
                        <!-- Topmost Group -->
                        <group>
                            <!-- First Column -->
  
                            <group>
                            <field name="status" invisible="1"/>
                                <field name="mon_no"/>
                                <field name="filled_by"/>
                               
                               <field name="order_type" string="Order Type"/>
                                <field name="logged_inuser_group" invisible="1"/>
                                <field name="indent_ref_no" invisible="logged_inuser_group == False"/>
                               <field name="auto_load"  invisible="order_type == 'FG' or order_type == 'SFG' or order_type == 'SFG,FG' or order_type == 'FG,SFG'" />
<field name="auto_load_sfg_items" invisible="auto_load == 'fg' or auto_load == False" />
<field name="auto_load_fg_item_ids" invisible="1"/>
<field name="auto_load_fg_items" invisible="auto_load == 'sfg' or auto_load == False" />
<field name="set_qty" invisible="auto_load == 'fg' or auto_load == False" />
<field name="fg_set_qty" invisible="auto_load != 'fg'" />

                            </group>
                            <!-- Second Column -->
                            <group>
                      <field name="mon_date"/>
                      <field name="dept"/>
                     
 <field name="purpose"/>
  <field name="po_no" groups="sos_inventory.sos_ce_user,sos_inventory.sos_ce_head,sos_inventory.sos_management_user"/>

 <field name="service_call_ref_no" groups="sos_inventory.sos_ce_user,sos_inventory.sos_ce_head,sos_inventory.sos_management_user"/>

 <field name="min_no" string="Issue Note Ref No" invisible="min_no == False" readonly="1"/>

                            </group>
                        </group>
                     
                        
                
                             <notebook>
                            <page string="Materials" invisible="material_option == False">
  <div style="float:right;margin-bottom: 10px;"> <button string="Bulk Upload Materials" type="object" name="action_bulk_upload" class="oe_highlight"/></div>
                                <field name="line_ids_material" readonly="dept_in_charge_name">
                                    <tree editable="bottom">
                                    <field name="s_no"/>
                                        <field name="com_type" decoration-info="com_type == 'new'"/>
                                        <field name="value" string="Search By Value"/>
                                        <field name="helper_field" column_invisible="1"/>
                                        <field name="component_id" decoration-info="com_type == 'new'" required="com_type == 'exits'" readonly="com_type == 'new'"  domain="[('id', 'in', helper_field)]"/>
                                        <field name="material_code" decoration-info="com_type == 'new'" groups="sos_inventory.sos_scg_group_user"/>
                                        <field name="new_component_id" decoration-info="com_type == 'new'" required="com_type == 'new'" readonly="com_type == 'exits'"/>
                                        <field name="approx_price" decoration-info="com_type == 'new'"/>
                                        <field name="uom" readonly="com_type != 'new'" decoration-info="com_type == 'new'"/>
                                        <field name="specifications" decoration-info="com_type == 'new'"/>
                                        <field name="quantity" required="1" decoration-info="com_type == 'new'"/>
                                        <field name="location" decoration-info="com_type == 'new'" groups="sos_inventory.sos_scg_group_user"/>
                                    </tree>
                                 
                                </field>
                                                               <div class="oe_subtotal_footer" style="float: right;
    padding: 20px;
    border: solid 1px #ccc;
    font-weight: bold;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;">

    <!-- Gross Value Field -->
    <div style="margin-bottom: 5px;">
        <label for="approx_value" style="font-weight: bold; margin-right: 10px;">Approximate Value</label>
        <field name="approx_value" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/>
    </div>
    </div>
   
                            </page>
                            <page string="Semi-Finished Goods" invisible="sfg_option == False">
                                <field name="line_ids_sfg" readonly="dept_in_charge_name">
                                    <tree editable="bottom">
                                        <field name="component_id"/>
                                        <field name="uom"/>
                                        <field name="specifications"/>
                                        <field name="quantity" required="1"/>
                                        <field name="location" groups="sos_inventory.sos_scg_group_user"/>



                                   
                                    </tree>
                                 
                                </field>
   
                            </page>
                            <page string="Finished Goods" invisible="fg_option == False">
                                <field name="line_ids_fg" readonly="dept_in_charge_name">
                                    <tree editable="bottom">
                                        <field name="component_id"/>
                                        <field name="uom"/>
                                        <field name="specifications"/>
                                        <field name="quantity" required="1"/>
                                        <field name="location" groups="sos_inventory.sos_scg_group_user"/>


                                   
                                    </tree>
                                 
                                </field>
   
                            </page>
                        </notebook>
                        <br></br> <br></br>
                        <templates>
    <div class="row">
    <div class="col-md-5" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;        padding-right: 0px;padding-left: 0px;">
       <table class="table">
     <tr><td colspan="2" class="table_custom_header">To Be Filled By <span style="font-size: 18px;padding: 0px; color: #ffcc00;">User</span></td></tr>

        <tr>
            <td style="padding: 8px;" class="column"><b>Prepared by</b>
                <button string="Approve" invisible="prepared_by_image" class="btn-primary custom_btn" type="object" name="action_report_esign_btn"></button>
            </td>
            <td><field name="prepared_by_image" widget="image"/></td>
        </tr>
        <tr invisible="prepared_by_image == False">
            <td style="padding: 8px;" class="column"><b>Prepared On</b></td>
            <td><field name="prepared_on" readonly="1"/></td>
        </tr>
        <tr invisible="prepared_by_image == False">
            <td style="padding: 8px;" class="column"><b>Prepared By</b></td>
            <td><field name="prepared_by_name" readonly="1"/></td>
        </tr>
    </table>
    </div>
    <div class="col-md-2"></div>
    <div class="col-md-5" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;        padding-right: 0px;padding-left: 0px;">
       <table class="table">
         <tr><td colspan="2" class="table_custom_header">To Be Filled By <span style="font-size: 18px;padding: 0px; color: #ffcc00;">Department Incharge</span></td></tr>

        <tr style="border-bottom: solid 1px #ccc;">
            <td style="padding: 8px;" class="column"><b>Department Incharge</b>
                <button string="Approve" invisible="dept_in_charge_image" class="btn-primary custom_btn" type="object" name="action_report_esign_btn1"></button>

            </td>
            <td><field name="dept_in_charge_image" widget="image"/></td>
        </tr>
        <tr invisible="dept_in_charge_image">
         <td style="padding: 8px;" class="column"><b>Rejection Reason</b></td>
        <td><field name="dept_in_charge_reject_remarks"/>
                <button string="Reject"  class="btn-primary custom_btn" type="object" name="action_departincharge_reject"></button>

            </td>
       
        </tr>
        <tr invisible="dept_in_charge_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="dept_in_charge_approved_on" readonly="1"/></td>
        </tr>
        <tr invisible="dept_in_charge_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="dept_in_charge_name" readonly="1"/></td>
        </tr>
    </table>
    </div>
    </div>
    <br></br>
    <div class="row">
        <div class="col-md-5" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;        padding-right: 0px;padding-left: 0px;">

       <table class="table">
     <tr><td colspan="2" class="table_custom_header">To Be Filled By <span style="font-size: 18px;padding: 0px; color: #ffcc00;">Top Management</span></td></tr>

        <tr>
            <td style="padding: 8px;" class="column"><b>Top Management</b>
                <button string="Approve" invisible="top_management_approval_image" class="btn-primary custom_btn" type="object" name="action_report_esign_btn2"></button>
            </td>
            <td><field name="top_management_approval_image" widget="image"/></td>
        </tr>
        <tr invisible="top_management_approval_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="top_management_approved_on" readonly="1"/></td>
        </tr>
        <tr invisible="top_management_approval_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="top_management_name" readonly="1"/></td>
        </tr>
    </table>
    </div>

 <div class="col-md-2"></div>
        <div class="col-md-5" style="box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;background-color: #fff;border: solid 4px #9689c1;        padding-right: 0px;padding-left: 0px;">
       <table  class="table">
             <tr><td colspan="2" class="table_custom_header">To Be Filled By <span style="font-size: 18px;padding: 0px; color: #ffcc00;">Stores</span> Team</td></tr>

<tr style="border-bottom: solid 1px #ccc;">
           <td style="padding: 8px;" class="column"><b>Remarks</b></td>
            <td><field name="stores_remarks"/></td>
        </tr>
        <tr>
            <td style="padding: 8px;" class="column"><b>Stores Incharge</b>
                <button string="Approve" invisible="stores_approved_image" class="btn-primary custom_btn" type="object" name="action_stores_esign_btn"></button>
            </td>
            <td><field name="stores_approved_image" widget="image"/></td>
        </tr>
        <tr invisible="stores_approved_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="stores_approved_on" readonly="1"/></td>
        </tr>
        <tr invisible="stores_approved_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="stores_approved_by" readonly="1"/></td>
        </tr>
    </table>
    </div>
</div>
                            </templates>

                    </sheet>
                </form>
        </field>
    </record>
<menuitem id="mon_menu"
              name="Order Note (ON)"
              parent="scg_forms_menu_root" action="action_mon_form_list" groups="sos_inventory.sos_healthcare_user,sos_inventory.sos_scg_group_manager,sos_inventory.sos_scg_group_user,sos_inventory.sos_ce_user,sos_inventory.sos_rd_user,sos_inventory.sos_production_user,sos_inventory.sos_qc_user,sos_inventory.sos_management_user,sos_inventory.sos_logistics_user,sos_inventory.sos_sales_user" />
              

</odoo>
