<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record model="ir.ui.view" id="sos_material_graph">
<field name="name">sos.material.graph</field>
<field name="model">sos_material</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Example" type="bar">
<field name="material_type_id" group="True"/>                                    
</graph>
</field>
</record>
<record id="sos_material_view_panel" model="ir.ui.view">
    <field name="name">sos_material.search</field>
    <field name="model">sos_material</field>
    <field name="arch" type="xml">
        <search>
            <searchpanel>
                <field name="material_type_id" string="Type" icon="fa-list-ul" enable_counters="1"/>
                <field name="material_sub_type" string="Category" icon="fa-pie-chart" enable_counters="1"/>
            </searchpanel>

            <!-- Add fields to search on -->
            <field name="part_no" string="Part No"/>
            <field name="material_code" string="Material Code"/>
            <filter string="Material Type" name="group_by_material_type" context="{'group_by': 'material_type_id'}"/>
            <filter string="Material Category" name="group_by_category" context="{'group_by': 'material_sub_type'}"/>

        </search>
    </field>
</record>
<record id="action_sos_material_query_wizard" model="ir.actions.act_window">
    <field name="name">Material Stock Status</field>
    <field name="res_model">sos_material_stock_report_wizard</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>
  <record id="action_owl_material_dashboard" model="ir.actions.client">
            <field name="name">Dashboard</field>
            <field name="tag">owl.material_dashboard</field> 
        </record>
    <record id="sos_material_view_tree" model="ir.ui.view">
        <field name="name">sos_material.view.tree</field>
        <field name="model">sos_material</field>
        <field name="arch" type="xml">
          <tree>
 <header>
<button  name="%(action_owl_material_dashboard)d" string="Dashboard" type="action" class="oe_highlight" display="always"/>
<button  name="%(action_sos_material_query_wizard)d" string="Stock Report" type="action" class="oe_highlight" display="always"/>

                </header>
          
            <field name="material_code"/>
             <field name="part_no"/>
                   <field name="inhand_stock_val" groups="sos_inventory.sos_scg_group_user,sos_inventory.sos_finance_user"/>
                    <field name="inhand_stock_qty" string="In-Hand Qty"/>
                    <field name="location" string="Location" groups="sos_inventory.sos_scg_group_user"/>
                    <field name="description" groups="sos_inventory.sos_rd_user,sos_inventory.sos_qc_user,sos_inventory.sos_production_user"/>
                    <field name="category" optional="hide" groups="sos_inventory.sos_scg_group_user"/>
                    <field name="image" widget="image" class="oe_avatar" optional="hide" groups="sos_inventory.sos_scg_group_user"/>
             <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_material_kanban_view" model="ir.ui.view">
            <field name="name">sos_material.kanban</field>
            <field name="model">sos_material</field>
            <field name="arch" type="xml">
                <kanban class="o_kanban_mobile">
                    <field name="name"/>
                    <field name="material_type_id"/>
                    <templates>
                        <t t-name="kanban-box">
                            <div t-attf-class="oe_kanban_global_click sos_card">
                                <div class="row">
                                    <div class="col-9">
                                        <h4><field name="part_no"/></h4>
                                    </div>
                                    <div class="col-3 text-end">
                                    <div class="o_kanban_image">
                                    <img t-att-src="kanban_image('sos_material', 'image', record.id.raw_value)" alt="Avatar" class="o_image_64_cover rounded"/>
                                    </div>
                                    </div>
                                </div>
                                <div>
                                    <strong>Name: </strong><t t-out="record.name.value"/><br/>
                                    <strong>Type: </strong><t t-out="record.material_type_id.value"/>
                                </div>
                            </div>
                        </t>
                    </templates>
                </kanban>
            </field>
        </record>
 <record id="action_material_list" model="ir.actions.act_window">
    <field name="name">Materials</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">sos_material</field>
    <field name="view_mode">tree,form,kanban,graph</field>
    <field name="view_id" ref="sos_material_view_tree"/>
</record>
       <record id="sos_material_form_view" model="ir.ui.view">
      <field name="name">Form</field>
        <field name="model">sos_material</field>
        <field name="arch" type="xml">
            <form string="stocks">
            <sheet>
                <h2 style="text-align: center;text-transform: uppercase;text-shadow: 1px 1p 1px #140718;color: #65407c;padding:5px;">Materials</h2><hr></hr><br></br>
             <group>
    <!-- Left Column -->
    <group>
        <field name="material_code" readonly="1" force_save="1"/>
        <field name="part_no"/>
        <field name="material_type_id"/>
        <field name="material_sub_type"/>
        <field name="name"/>
        <field name="description"/>
        <field name="category"/>
        <field name="uom"/>
        <field name="shelf_life"/>
        <field name="inspection_method" widget="color_picker"/>
        <field name="qp_no"/>
        <field name="hsn_code"/>
        <field name="unit_price"/>
        <field name="blocked_qty"/>
        <field name="minimum_stock_qty"/>
        <field name="minimum_order_qty"/>
        <field name="std_packing_qty"/>
        <field name="opening_bal_qty" readonly="1"/>
    
    </group>

    <!-- Right Column -->
    <group>
        <!-- Image at the top of the right column -->
        <field name="image" widget="image" class="oe_avatar" string=""/>

        <field name="msp"/>
        <field name="order_qty"/>
        <field name="suppliers" widget="many2many_tags"/>
        <field name="inhand_stock_qty"/>
        <field name="inhand_stock_val"/>
        <field name="received_qty"/>
        <field name="received_stock_val"/>
        <field name="in_transit_stock_qty"/>
        <field name="in_transit_stock_val"/>
        <field name="issued_qty"/>
        <field name="issued_val"/>
        <field name="defect_qty"/>
        <field name="cancelled_qty"/>
        <!-- Continue with other fields -->
        <field name="location"/>
    </group>
</group>

     
           <notebook>
                            <page string="IN - History">
                                <field name="line_ids_in">
                                    <tree editable="bottom" delete="false" create="false">
                                    <field name="date"/>
                                        <field name="quantity"/>
                                        <field name="unit_price"/>
                                        <field name="ir_no" readonly="1"/>
                                        <field name="mrn_no" readonly="1"/>
                                        <field name="action" column_invisible="1"/>
                                       
                                    </tree>
                                 
                                </field>
   
                            </page>
                            <page string="OUT - History">
                                <field name="line_ids_out">
                                    <tree editable="bottom" delete="false" create="false">
                                    <field name="date"/>
                                        <field name="quantity"/>
                                        <field name="min_no"/>
                                        <field name="action" column_invisible="1"/>
                                       
                                    </tree>
                                 
                                </field>
   
                            </page>
                            </notebook>
  
                </sheet>
            </form>
        </field>
    </record>

              <menuitem id="material_master_menu"
              name="Materials/Components Stores"
              parent="stores_menu_root"
              action="action_material_list"/>
          
</odoo>
