Odoo Help

0

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

By
Abdul wahid
on 7/22/15, 5:36 AM 888 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

'get_filtered_purchase()'


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)
self.localcontext.update({
'time': time,
# 'get_purchase': self.get_purchase,
'get_filtered_purchase':self.get_filtered_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" />
<td>
<strong>
<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>
</tr>
</strong>
<!--<strong>Purchase Order:-->
<!--<t t-set="records" t-value="get_purchase()"/>-->
<!--<table>-->
<!--<thead>-->
<!--<th>Reference</th>-->
<!--<th>Order Date</th>-->
<!--</thead>-->
<!--<tbody>-->
<!--<tr t-foreach="records" t-as="record">-->
<!--<td><span t-esc="record.name"/> </td>-->
<!--<td><span t-esc="record.date_order"/></td>-->
<!--</tr>-->
<!--</tbody>-->
<!--</table>-->
<!--&lt;!&ndash;<span t-esc="name"/>&ndash;&gt;-->
<!--</strong>-->
</td>

<!--<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>-->
</div>
</t>
</t>
</t>
</template>



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

Hiral Patel (hip)
on 7/22/15, 5:53 AM
2
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))

to

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.

Register

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)

Stats

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