Hello,
I'm try to create Invoive copy receipt from POS screesn. but when I try to print bill I got this error.
NoneType' object is not callable" while evaluating 'get_journal_amt(o)'
import time from openerp.osv import osv from openerp.report import report_sxw def titlize(journal_name): words = journal_name.split() while words.pop() != 'journal': continue return ' '.join(words) class family_order(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(family_order, self).__init__(cr, uid, name, context=context) user = self.pool['res.users'].browse(cr, uid, uid, context=context) partner = user.company_id.partner_id self.localcontext.update({ 'time': time, # 'disc': self.discount, 'net_amount': self._netamount, 'get_journal_amt': self._get_journal_amt, # 'get_journal_amt': self._get_journal_amt, 'address': partner or False, 'titlize': titlize })
def _netamount(self):
res = {'name': 'hello'} return res def _get_journal_amt(self, order_id): data={} sql = """ select aj.name,absl.amount as amt from account_bank_statement as abs LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id LEFT JOIN account_journal as aj ON aj.id = abs.journal_id WHERE absl.pos_statement_id =100""" self.cr.execute(sql, order_id) data = self.cr.dictfetchall() return data class bill_copy_report(osv.AbstractModel): _name = 'report.point_of_sale.bill_copy' _inherit = 'report.abstract_report' _template = 'point_of_sale.bill_copy' _wrapped_report_class = family_order # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # -*- coding: utf-8 -*-
##############################################################################
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="bill_copy">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<div class="page">
<div class="row">
<div class="col-xs-12 text-center">
<span t-field="o.table_id"/>
Hello
<table class="table table-condensed">
<thead>
<tr>
<th>Description</th>
<th class="text-right">Quantity</th>
<th class="text-right">Price</th>
</tr>
</thead>
<!--<tbody>-->
<!--<!–<tr t-foreach ="o.lines" t-as="line">–>-->
<!--<!–<td><span t-field="line.name"/></td>–>-->
<!--<!–</tr>–>-->
<!--<tr t-foreach="net_amount()" t-as="d">-->
<!--<td>-->
<!--<span t-esc="d['product_id']"/>-->
<!--</td>-->
<!--</tr>-->
<!--</tbody>-->
<tbody>
<tr t-foreach="get_journal_amt(o)" t-as="d">
<td>
<span t-esc="d['name']"/>
</td>
<td>
<span t-esc="formatLang(d['amt'], currency_obj=res_company.currency_id)"/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</t>
</t>
</template>
</data>
</openerp>
Anyone know how to resolve this ?
Thank you...