Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to show data in to a tree view based on a wizard filter field for a custom module

By
Odoo
on 10/30/14, 1:13 PM 1,266 views

Hi,

I want to filter some data from a wizard (date field)..

scenario--

when I click on sale details menu ,it generate a wizard with asking some date, based on that date I want to filter some data and add that fields to my tree view. How its posible I create the module ,But I want to add this queries into my module and shows it in my tree view need a help,,

This is my query 

----------------

where I can write this query into my custom module

SELECT sale_order.origin,
    sale_order.create_date,
    sale_order.partner_id,
    sale_order.fiscal_position,
    sale_order.amount_untaxed
   FROM sale_order where sale_order.create_date='2014-07-13 08:23:24.386'
)#This is the date(ale_order.create_date='2014-07-13 08:23:24.386) I want to enter from that wizard ,based on this date I want to filter the data and add this query result into a tree view

 

This is my code-------

wizard folder ------------------------------------------------

init.py--

import sale_analysis  

--------------------------------------------------------------

sale_analysis_view.xml----------

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <record id="view_sale_details_analysis" model="ir.ui.view">
            <field name="name">Sale Analysis Details</field>
            <field name="model">sale.analysis</field>
            <field name="arch" type="xml">
                <form string="Sale Analysis" version="7.0">
                    <group col="4">
                        
                        <field name="date_from"/>
                        
                    </group>
                    <footer>
                        <button name="sale_analysis" string="Check " type="object" default_focus="1" class="oe_highlight"/>
                        
                    or
                    
                        <button string="Cancel" class="oe_link" special="cancel" />
                    </footer>
                </form>
            </field>
        </record>
        
        
        
        
        <record id="action_sale_details" model="ir.actions.act_window">
            <field name="name">Sales Analysis</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.analysis</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="target">new</field>
            <field name="view_id" ref="view_sale_details_analysis"/>
        </record>

        

        <menuitem name="Sale Analysis Details" id="menu_sale_report" parent="base.menu_base_partner"  groups="base.group_sale_salesman_all_leads" sequence="20"/>
        <menuitem name="Sales Analysis" parent="menu_sale_report" action="action_sale_details"
            id="menu_sale_details" />

    </data>
</openerp>

---------------------------------------------------------------

sale_analysis.py

import time
from openerp.osv import fields, osv

class sale_analysis(osv.osv_memory):
    _name = 'sale.analysis'
    _description = 'Sale Analysis wizard'

    _columns = {
        'date_from': fields.date('Enter a Date', required=True)

    }
    
    
    


    _defaults = {
        'date_from': lambda *a: time.strftime('%Y-%m-01')
    }
    

sale_analysis()

--------------------------------------------------------------------------------------------------

init.py---

import wizard

--------------------------------------------------------------------------------------------------

openerp.py---


{
    'name': 'Sale Analysis Demo',
    'version': '1.0',
    'category': 'Customizations',
    'description': """
        Stage : Development.
        
         Sales reports
        -
""",
    'author': 'Libu',
    'website': 'http://mysite.com',
    'summary': '',
    'depends': [
            'sale'
    ],
    'data': [
             'wizard/sale_analysis_view.xml'
             
    ],
    'images': [ ],
    'installable': True,
    'application': False,
    'auto_install': False,
}

 

 

 

 

 

 

 

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/30/14, 1:13 PM
Seen: 1266 times
Last updated: 3/16/15, 8:10 AM