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

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

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

--Axel Mendoza--
10263
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

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


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

2 follower(s)

Stats

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