Odoo Help


"'psycopg2._psycopg.cursor' object has no attribute 'excecute'" while evaluating 'get_filtered_purchase()'

Abdul wahid
on 7/22/15, 5:36 AM 1,116 views

i am passing values from parser class to report template by using cr.execute.but i am getting this error

"'psycopg2._psycopg.cursor' object has no attribute 'excecute'" while evaluating


my parser class

class purchase_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(purchase_report, self).__init__(cr, uid, name, context=context)
'time': time,
# 'get_purchase': self.get_purchase,

def get_filtered_purchase(self):
uid = self.uid
ids = self.ids
filter_rec = self.pool.get('filter_wizard').browse(self.cr,uid,ids)
cu_id = filter_rec.customer.id
self.cr.excecute("SELECT partner_id FROM purchase_order WHERE partner_id = %s " %(cu_id))
return self.cr.fetchall()

class report_purchaseorder_qweb(osv.AbstractModel):
_name = 'report.ship.report_wizard'
_inherit = 'report.abstract_report'
_template = 'ship.report_wizard'
_wrapped_report_class = purchase_report

and my template

<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="oe_structure" />
<t t-set="records" t-value="get_filtered_purchase()"/>
<tr t-foreach="records" t-as="rec">
<td><span t-esc="rec.name"/> </td>
<td><span t-esc="rec.date_order"/></td>
<!--<strong>Purchase Order:-->
<!--<t t-set="records" t-value="get_purchase()"/>-->
<!--<th>Order Date</th>-->
<!--<tr t-foreach="records" t-as="record">-->
<!--<td><span t-esc="record.name"/> </td>-->
<!--<td><span t-esc="record.date_order"/></td>-->
<!--&lt;!&ndash;<span t-esc="name"/>&ndash;&gt;-->

<!--<div class="text-center"><h1><span t-esc="doc.customer"></span></h1></div>-->
<!--<div class="text-center"><h1><span t-esc="doc.selection_field"></span></h1></div>-->
<!--<div class="text-center"><h1><span t-esc="doc.date_from"></span></h1></div>-->
<!--<div class="text-center"><h1><span t-esc="doc.date_to"></span></h1></div>-->
<!--<div class="text-center"><h1><span t-esc="o.purchase_order"></span></h1></div>-->

Typo mistake: self.cr.execute("")

Hiral Patel (hip)
on 7/22/15, 5:53 AM
Axel Mendoza
On 7/22/15, 1:03 PM

you need to change

self.cr.excecute("SELECT partner_id FROM purchase_order WHERE partner_id = %s " %(cu_id))


self.cr.execute("SELECT partner_id FROM purchase_order WHERE partner_id = %s " %(cu_id)) 

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

2 follower(s)


Asked: 7/22/15, 5:36 AM
Seen: 1116 times
Last updated: 7/30/15, 2:10 AM