Odoo Help


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

on 10/30/14, 1:13 PM 1,405 views


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


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,
   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 ------------------------------------------------


import sale_analysis  



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

        <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"/>
                        <button name="sale_analysis" string="Check " type="object" default_focus="1" class="oe_highlight"/>
                        <button string="Cancel" class="oe_link" special="cancel" />
        <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"/>


        <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" />




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')




import wizard



    'name': 'Sale Analysis Demo',
    'version': '1.0',
    'category': 'Customizations',
    'description': """
        Stage : Development.
         Sales reports
    'author': 'Libu',
    'website': 'http://mysite.com',
    'summary': '',
    'depends': [
    'data': [
    '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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


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