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>--> <!--<!–<span t-esc="name"/>–>--> <!--</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("")