简体   繁体   English

如何在 qweb 报告中添加分隔符?

[英]How to add a separator in qweb report?

I want to add separator ',' in qweb report, to get the following result: session1,session2,session3 instead of: session1session2session3我想在 qweb 报告中添加分隔符 ',' 以获得以下结果: session1,session2,session3而不是: session1session2session3

Here is my code:这是我的代码:

<tr t-foreach='sessions' t-as='session'>
      <td><t t-esc="session.name" /></td>
  </tr>

I tried to use我试着用

<t t-esc="', '.join(sessions).mapped('session.name')"/> 

but I got an error,但我有一个错误,

odoo.addons.base.models.qweb.QWebException: sequence item 0: expected str instance, pos.config found
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 331, in _compiled_fn
    return compiled(self, append, new, options, log)
  File "<template>", line 1, in template_point_of_sale_report_saledetails_123
  File "<template>", line 3, in body_call_content_121
  File "<template>", line 4, in body_call_content_119
  File "<template>", line 9, in foreach_98
TypeError: sequence item 0: expected str instance, pos.config found

Error to render compiling AST
TypeError: sequence item 0: expected str instance, pos.config found
Template: point_of_sale.report_saledetails
Path: /t/t[2]/t/div/div/tr/td[2]/t
Node: <t t-esc="', '.join(sessions).mapped('session.name')"/>

Any help please?请问有什么帮助吗? Thanks.谢谢。

Try:尝试:

<t t-esc="', '.join(sessions.mapped('name'))"/> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM