[英]an unknown error on a live server but the module works very well on localhost
i am currently working on a project built using python and xml on odoo framework to generate a custom qwebreport with some data.我目前正在使用 python 和 xml 在 odoo 框架上构建一个项目,以生成带有一些数据的自定义 qwebreport。 .Its working very well on localhost where the port is being generated very well without any issues.
.它在本地主机上工作得很好,端口生成得很好,没有任何问题。 But when the module is run on a live server,it returns an error.The error is as follows:
但是当模块在实时服务器上运行时,它返回错误。错误如下:
Error:Odoo Server Error
Traceback (most recent call last): File
"/opt/odoo12/odoo/odoo/addons/base/models/qweb.py", line 347, in
_compiled_fn return compiled(self, append, new, options, log)
File "<template>", line 1, in template_4549_24 File "
<template>", line 2, in body_call_content_23 File "<template>",
line 3, in body_call_content_22TypeError: 'NoneType' object is
not callable
During handling of the above exception, another exception
occurred:
Traceback (most recent call last): File
"/opt/odoo12/addons/web/controllers/main.py", line 1675, in
report_download response = self.report_routes(reportname,
converter=converter, **dict(data)) File
"/opt/odoo12/odoo/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw) File
"/opt/odoo12/addons/report_xlsx/controllers/main.py", line 43, in
report_routes reportname, docids, converter, **data File
"/opt/odoo12/odoo/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw) File
"/opt/odoo12/addons/web/controllers/main.py", line 1612, in
report_routes pdf =
report.with_context(context).render_qweb_pdf(docids, data=data)
[0] File
"/opt/odoo12/odoo/odoo/addons/base/models/ir_actions_report.py",
line 721, in render_qweb_pdf html =
self.with_context(context).render_qweb_html(res_ids, data=data)
[0] File "/opt/odoo12/addons-
enterprise/web_studio/models/ir_actions_report.py", line 18, in
render_qweb_html return super(IrActionsReport,
self).render_qweb_html(docids, data) File
"/opt/odoo12/odoo/odoo/addons/base/models/ir_actions_report.py",
line 761, in render_qweb_html return
self.render_template(self.report_name, data), 'html' File
"/opt/odoo12/odoo/odoo/addons/base/models/ir_actions_report.py",
line 534, in render_template return
view_obj.render_template(template, values) File
"/opt/odoo12/odoo/odoo/addons/base/models/ir_ui_view.py", line
1324, in render_template return
self.browse(self.get_view_id(template)).render(values, engine)
File "/opt/odoo12/addons/website/models/ir_ui_view.py", line 315,
in render return super(View, self).render(values,
engine=engine, minimal_qcontext=minimal_qcontext) File
"/opt/odoo12/addons/web_editor/models/ir_ui_view.py", line 27, in
render return super(IrUiView, self).render(values=values,
engine=engine, minimal_qcontext=minimal_qcontext) File
"/opt/odoo12/odoo/odoo/addons/base/models/ir_ui_view.py", line
1333, in render return self.env[engine].render(self.id,
qcontext) File "/opt/odoo12/addons-
enterprise/web_studio/models/ir_qweb.py", line 43, in render
return super(IrQWeb, self).render(template, values=values,
**options) File
"/opt/odoo12/odoo/odoo/addons/base/models/ir_qweb.py", line 59,
in render result = super(IrQWeb, self).render(id_or_xml_id,
values=values, **context) File
"/opt/odoo12/odoo/odoo/addons/base/models/qweb.py", line 275, in
render self.compile(template, options)(self, body.append,
values or {}) File
"/opt/odoo12/odoo/odoo/addons/base/models/qweb.py", line 354, in
_compiled_fn raise QWebException("Error to render compiling
AST", e, path, node and etree.tostring(node[0],
encoding='unicode'),
name)odoo.addons.base.models.qweb.QWebException: 'NoneType'
object is not callableTraceback (most recent call last): File
"/opt/odoo12/odoo/odoo/addons/base/models/qweb.py", line 347 in_compiled_fn
return compiled(self, append, new, options,log)
File "<template>", line 1, in template_4549_24
File "<template>", line 2, in body_call_content_23 File "<template>",line 3, in body_call_content_22
TypeError:'NoneType' object is not callable
Error to render compiling ASTTypeError: 'NoneType' object is not callableTemplate: 4549Path: /templates/t/t/t/div[2]/div/table/tbody/tNode: <t t-foreach="sorted(vals)" t-as="o">
My code to generate the report is as it follows:我生成报告的代码如下:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<template id="report_immunization">
<t t-call="web.html_container">
<t t-call="web.basic_layout">
<div class="header">
<div style="width: 45%;float: left;">
<img
src='/oeh_immunization/static/description/rva_logo.jpg'
style="width:50%"/>
</div>
</div>
<div class="page">
<br/><br/><br/>
<b><h3>Immunization Report</h3></b>
<br/>
<b>Date Prepared:</b>
<span t-esc="datetime.date.today().strftime('%B %d,%Y')"/><br/>
<br/>
<div class="row">
<table class="table table-condensed mt32">
<thead>
<tr style="background-color:#909090;">
<th class="text-left">Vaccine Name</th>
<th class="text-left">Student's Name</th>
<th class="text-left">Dose Number</th>
<th class="text-left">Date <br/>Administered</th>
<th class="text-left">Next Due <br/>Date</th>
<!-- <th class="text-left">Administering<br/> Facility</th> -->
<th class="text-left">Clinician</th>
<!-- <th class="text-left">Adverse<br/> events <br/>observed?</th>
<th class="text-left">Adverse<br/> events<br/> reported<br/> to <br/>CDC<br/> VAERS?</th>
<th class="text-left">Observations</th> -->
<th class="text-left">On<br/> Schedule?</th>
</tr>
</thead>
<tbody class="invoice_tbody">
<t t-foreach="sorted(vals)" t-as="o">
<tr>
<td>
<p t-esc="o" class="m-0"/>
</td>
<td>
<p t-esc="vals[o][0]['patient']" class="m-0"/>
</td>
<td>
<p t-esc="vals[o][0]['dose']" class="m-0"/>
</td>
<td>
<p t-esc="vals[o][0]['date']" class="m-0"/>
</td>
<td>
<p t-esc="vals[o][0]['next_due_date']" class="m-0"/>
</td>
<td>
<p t-esc="vals[o][0]['doctor']" class="m-0"/>
</td>
<td>
<p t-esc="vals[o][0]['on_schedule']" class="m-0"/>
</td>
</tr>
<t t-foreach="vals[o][1:]" t-as="i">
<tr>
<td>
</td>
<td>
<p t-esc="i['patient']" class="m-0"/>
</td>
<td>
<p t-esc="i['dose']" class="m-0"/>
</td>
<td>
<p t-esc="i['date']" class="m-0"/>
</td>
<td>
<p t-esc="i['next_due_date']" class="m-0"/>
</td>
<td>
<p t-esc="i['doctor']" class="m-0"/>
</td>
<td>
<p t-esc="i['on_schedule']" class="m-0"/>
</td>
</tr>
</t>
</t>
</tbody>
</table>
<div class="oe_structure"/>
</div>
</div>
</t>
</t>
have you used this:-你用过这个吗:-
<record id="project_task_template" model="ir.actions.report">
<field name="name">Project Report</field>
<field name="model">project.task</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">construction_management.task_invoice</field>
<field name="report_file">construction_management.task_invoice</field>
<field name="binding_model_id" ref="model_project_task"/>
<field name="binding_type">report</field>
</record>
if so then please itrate docs over a for loop in your XML file: after this (t-call="web.basic_layout") like (t-foreach="docs" t-as='o') and use (o.field_name) for example:如果是这样,请在您的 XML 文件中通过 for 循环对文档进行 itrate:在此之后 (t-call="web.basic_layout") like (t-foreach="docs" t-as='o') 并使用 (o. field_name) 例如:
<t t-foreach="doc.move_ids_without_package" t-as="line">
<p t-out="line.product_uom_qty"/>
<p t-out="line.display_name"/>
<p t-out="line.product_id.name"/>
<t t-if="website_label_type == 'bsku'">
<span t-out="line.product_id.bsku"/>
</t>
<t t-else="">
<span t-out="line.product_id.asin"/>
</t>
</t>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.