标签:"'nonetype' object is not callable" while evaluating
class:
import time from openerp.osv import osv from openerp.report import report_sxw class stock_picking_out(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(stock_picking_out, self).__init__(cr, uid, name, context=context) self.localcontext.update({ ‘time‘: time, ‘get_partner_product‘: self._get_partner_product, }) # todo 获取客户产品编码: def _get_partner_product(self, partner, product_id): sql = """SELECT cp.partner_default_code FROM customer_product cp LEFT JOIN res_partner rp ON rp.id = cp.partner_id WHERE cp.product_id = %s AND cp.partner_id = %s""" self.cr.execute(sql, (product_id, partner)) sql_data = self.cr.fetchall() if len(sql_data) > 0: for obj in sql_data: partner_default_code = obj[0] return partner_default_code return ‘‘ class report_stockpickingout(osv.AbstractModel): _name = ‘report.report_stock.report_stockpickingout‘ _inherit = ‘report.abstract_report‘ _template = ‘report_stock.report_stockpickingout‘ _wrapped_report_class = stock_picking_out
Report_view:
<td class="text-left">
<span t-esc="get_partner_product(doc.partner_id.id,l.product_id.id)"/>
</td>
当我在打印的时候,报出的问题:
QWebException: "‘NoneType‘ object is not callable" while evaluating ‘get_partner_product(doc.partner_id.id,l.product_id.id)‘
Answer:
在"_name"时,路径的错误,必须要添加上"report"的引用:
class report_stockpickingout(osv.AbstractModel): _name = ‘report.report_stock.report_stockpickingout‘
本文出自 “时空旅行者” 博客,请务必保留此出处http://siweilai.blog.51cto.com/9233507/1881973
标签:"'nonetype' object is not callable" while evaluating
原文地址:http://siweilai.blog.51cto.com/9233507/1881973