Qweb报告错误无类型'对象不可调用"在评估时

时间:2017-09-30 05:37:41

标签: python openerp qweb

所有 我知道这需要的不仅仅是时间,但我有太多时间来解决这个问题。

class swiss_customs_invoice_report(report_sxw.rml_parse):

  def __init__(self, cr, uid, name, context):
    super(swiss_customs_invoice_report, self).__init__(cr, uid, name, context)
    self.localcontext.update({

        'get_nw_total':self.get_nw_total,
    })

    self.nw_total=0.0

  def get_nw_total(self):
    return self.nw_total



class swiss_customs_invoice(osv.AbstractModel):
_name = 'report.account_invoice_ept.report_invoice_document_ept_b2c'
_inherit = 'report.abstract_report'
_template = 'account_invoice_ept.report_invoice_document_ept_b2c'
_wrapped_report_class = swiss_customs_invoice_report

这是我的类来描述那个和我的其他XML

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
    <template id="report_invoice_document_ept_b2c">
        <t t-call="account_invoice_ept.external_layout_ept_b2c">
            <t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />
            <div class="page">
                <div class="row">
                    <div class="col-xs-5 col-xs-offset-7">
                        <address t-field="o.partner_id"
                            t-field-options='{"widget": "contact", "fields": ["address", "name","phone","mobile"], "no_marker": true}' />
                        <span t-if="o.partner_id.vat">
                            TIN:
                            <span t-field="o.partner_id.vat" />
                        </span>
                    </div>
                </div>                  

                <div>
                    <div class="col-xs-2">
                        <strong>Demo Defult</strong>
                        <span t-esc="get_nw_total()"></span>
                    </div>
                </div>
            </div>
        </t>
    </template>

    <template id="report_invoice_ept_b2c">
        <t t-call="report.html_container">
            <t t-foreach="docs" t-as="o">
                <t t-call="account_invoice_ept.report_invoice_document_ept_b2c"
                    t-lang="o.partner_id.lang" />
            </t>
        </t>
    </template>


    <report id="report_action_invoice_ept_b2c" string="Swiss Customs Invoice"
        model="account.invoice" report_type="qweb-pdf"
        file="account_invoice_ept.report_invoice_ept_b2c" name="account_invoice_ept.report_invoice_ept_b2c" />

</data>

那么如何解决这个问题和所有时间给我的错误是NoneType&#39;对象不可调用&#34;同时评估和使用

  

o.get_nw_total()   docs.get_nw_total()

堆栈中的其他所有灵魂。

0 个答案:

没有答案