Odoo Help


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.


how to pass filtered purchase orders to report

Abdul wahid
on 7/21/15, 1:52 AM 444 views

hi, i need to pass filtered purchase orders to a report. the report prints from button function call.

i have two buttons on my wizard. one is to filter the purchase orders based on the field values present in the wizard.and the other is a print button which should print the filtered purchase orders.now the filtering works fine.what should i do to print the filtered purchase orders on my button click

this is my function to print the wizard, and it is incomplete

def print_wizard(self,cr,uid,ids,context=None):


if context is None:

context = {}

data = self.read(cr, uid, ids)[0]

datas = {

'ids': [],

'model': 'filter_wizard',

'form': data,


return {'type': 'ir.actions.report.xml', 'report_name': 'Ship.report_wizard','datas': datas}

and this is filter function which works

def filter_opt(self,cr,uid,ids,context=None):


filter_rec = self.browse(cr,uid,ids,context=context)


sel_field = filter_rec.selection_field

#order_id = context.get('active_id',False)

# sal_obj = self.pool.get('sale.order').browse(cr,uid,ids)

if filter_rec.customer and filter_rec.selection_field:

print "yes1"

if sel_field=='n':

DOMAIN=[('partner_id','=',cu_id) ,('state','=','progress'),('state','=','done')]

elif sel_field=='c':


elif sel_field=='n':

print "yes2"

DOMAIN=['|' ,('state','=','progress'),('state','=','done')]

elif sel_field=='c':

print "yes3"


elif filter_rec.customer:

# cu_id=filter_rec.customer.id

print "yes4"


elif filter_rec.date_from and filter_rec.date_to:

print "yes5"


elif filter_rec.date_from:

raise exceptions.except_orm(_('Warning!'), _('choose the necessary fields'))

elif filter_rec.date_to:

raise exceptions.except_orm(_('Warning!'), _('choose the necessary fields'))

return {

'name': ' purchase order ',

'view_type': 'tree',

'view_mode': 'tree',

'res_model': 'purchase.order',

'domain': DOMAIN,

'context': context,

'type': 'ir.actions.act_window',

'target': 'current',


this is my report

<report id="custom_report_wizard"








and this is my template

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



<template id="report_wizard">

<t t-call="report.html_container">

<t t-foreach="docs" t-as="doc">

<t t-call="report.external_layout">

<div class="page">

<div class="row" />

<!--<div class="text-center"><h1><span t-esc="doc"></span></h1></div>-->







<!--<template id="report_wizard">-->

<!--<t t-call="report.html_container">-->

<!--<t t-foreach="doc_ids" t-as="doc_id">-->

<!--<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'Ship.report_wizard_document')"/>-->






pls help me.. i am beginner

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)


Asked: 7/21/15, 1:52 AM
Seen: 444 times
Last updated: 7/21/15, 1:52 AM