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

        <!--                    <field name="period"/>-->
        <!--                    <field name="product_id"/>-->
        <!--                    <field name="price"/>-->
        <!--                </tree>-->
        <!--            </field>-->
        <!--        </record>-->

        <record id="view_tandur_price_hist_form" model="ir.ui.view">
            <field name="name">view.tandur.price.hist.form</field>
            <field name="model">tandur.price.hist</field>
            <field name="arch" type="xml">
                <form string="Price History">
                    <sheet>
                        <div class="oe_title">
                            <h1>
                                <field name="product_id"/>
                            </h1>
                        </div>
                        <group>
                            <field name="year" options="{'format': 0}"/>
                            <field name="month" options="{'format': 00}"/>
                            <field name="price"/>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="tandur_price_hist_graph">
            <field name="name">tandur.price.hist.graph</field>
            <field name="model">tandur.price.hist</field>
            <field name="arch" type="xml">
                <graph string="Price History" sample="1">
                    <field name="period"/>
                    <field name="product_id"/>
                    <field name="price" type="measure"/>
                </graph>
            </field>
        </record>
        <record model="ir.ui.view" id="tandur_price_hist_pivot">
            <field name="name">tandur.price.hist.pivot</field>
            <field name="model">tandur.price.hist</field>
            <field name="arch" type="xml">
                <pivot string="Price History" display_quantity="True" sample="1">
                    <field name="product_id" type="row"/>
                    <field name="period" type="row"/>
                    <field name="price" type="measure"/>
                </pivot>
            </field>
        </record>

        <record id="view_tandur_price_hist_filter" model="ir.ui.view">
            <field name="name">view.tandur.price.hist.filter</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="action_tandur_price_hist_search" 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="view_type">form</field>-->
        <!--            <field name="domain">[]</field> &lt;!&ndash; Force empty &ndash;&gt;-->
        <!--        </record>-->

        <record id="action_tandur_price_hist" 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,form,graph,pivot</field>
            <field name="search_view_id" ref="view_tandur_price_hist_filter"/>
            <field name="view_id" ref="view_tandur_price_hist_tree"/>
            <field name="help" type="html">
                <p class="o_view_nocontent_smiling_face">
                    History of Price Not Found
                </p>
            </field>
        </record>
    </data>

</odoo>