price_hist.xml 2.45 KB
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <record id="tandur_price_hist_view_tree" model="ir.ui.view">
            <field name="model">tandur.price.hist</field>
            <field name="arch" type="xml">
                <tree string="Price History" editable="top" sample="1" create="1" delete="1" multi_edit="0">
                    <field name="year"/>
                    <field name="month"/>
                    <field name="product_id"/>
                    <field name="price"/>
                </tree>
            </field>
        </record>

        <record id="view_tandur_price_hist_filter" model="ir.ui.view">
            <field name="name">tandur.price.hist.select</field>
            <field name="model">tandur.price.hist</field>
            <field name="arch" type="xml">
                <search string="Search Product">
                    <field name="product_id" string="Product"/>
                    <separator/>
                    <group expand="0" string="Group By...">
                        <filter string="Product" name="group_by_product" domain="[]" context="{'group_by': 'product_id'}"/>
                        <filter string='Year' name="group_by_year" domain="[]" context="{'group_by' : 'year'}"/>
                   </group>
                </search>
            </field>
        </record>
        
        <record id="tandur_price_hist_search_action" model="ir.actions.act_window">
            <field name="context">{'default_product_id': active_id, 'search_default_product_id': active_id}</field>
            <field name="name">Price History</field>
            <field name="res_model">tandur.price.hist</field>
            <field name="domain">[]</field> <!-- Force empty -->
        </record>

        <record id="tandur_price_hist_action" model="ir.actions.act_window">
            <field name="name">History of Price </field>
            <field name="res_model">tandur.price.hist</field>
            <field name="context">{'search_default_group_by_product': 1}</field>
            <field name="view_mode">tree</field>
            <field name="search_view_id" ref="view_tandur_price_hist_filter"/>
            <field name="view_id" ref="tandur_price_hist_view_tree"/>
            <field name="help" type="html">
                <p class="o_view_nocontent_smiling_face">
                    History of Price Not Found
                </p>
            </field>
        </record>
    </data>

</odoo>