简体   繁体   English

实时服务器上的未知错误,但该模块在本地主机上运行良好

[英]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.

相关问题 即使我在虚拟环境中安装了模块,“没有模块命名”错误也可以在本地主机上正常运行 - 'no module named' error even though I installed module in virtual environment and it works fine on localhost Python SocketServer适用于localhost,但不适用于服务器 - Python SocketServer works on localhost but not on server 模板可在Localhost上使用,但不能在生产/实时服务器上使用 - Templates Work on Localhost but Not Production / Live Server pg_dump:错误:无法将主机名“localhost”转换为地址:未知服务器错误 - pg_dump: error: could not translate host name "localhost" to address: Unknown server error Pyspark 一直挂在数据集上,而 Pandas 工作得很好 - Pyspark keeps hanging on dataset while Pandas works very well 在最坏的情况下尝试快速排序。 它运行良好,但在最坏的情况下会发生未知错误。 我认为 - Experimenting about Quick Sort in worst cases. It works well but in worst cases UnKnown error occurred. I think Python Websockets服务器可在localhost上运行,但不能在服务器上运行 - Python websockets server works on localhost but not on server 为什么我在实时服务器中运行 streamlit 时收到 OSError: [Errno 5] 输入/输出错误错误? 代码在我的本地主机上运行正常 - why im getting OSError: [Errno 5] Input/output error error while running streamlit in live server ? the code is running ok in my localhost 在远程服务器中获取 ODBC 错误,但本地主机有效 - Django-mssql-backend - Getting ODBC error in remote server, but localhost works - Django-mssql-backend 在Heroku上找不到parse_rest模块,但在localhost上有效 - parse_rest module not found on Heroku, but works on localhost
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM