Odoo中文网|Odoo实施培训

 找回密码
 立即注册
搜索
热搜: Odoo OpenERP 实施
查看: 6790|回复: 0
打印 上一主题 下一主题

为报告添加支持翻译

[复制链接]

68

主题

96

帖子

456

积分

中级会员

Rank: 3Rank: 3

积分
456
跳转到指定楼层
楼主
发表于 2018-4-24 10:25:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
报告源码:
<odoo>
        <report id="action_todo_model_report"
           string="To-do Special Report"
           model="todo.task"
           report_type="qweb-html"
           name="todo_report.report_todo_task_special"
        />
        <template id="report_todo_task_special">
           <t t-call="report.html_container">
                <t t-call="report.external_layout">
                    <div class="page">
                 <!-- Report page content -->
                    <table class="table table-striped">
                            <tr>
                             <th>Title</th>
                             <th>Owner</th>
                             <th>Deadline</th>
                            </tr>
                        <t t-foreach="docs" t-as="o">
                            <tr>
                                <td class="col-xs-6">
                                <span t-field="o.name" />
                                </td>
                                <td class="col-xs-3">
                                <span t-field="o.user_id" />
                                </td>
                                <td class="col-xs-3">
                                <span t-field="o.date_deadline" />
                                </td>
                            </tr>
                        </t>
                    </table>
                    </div>
                </t>
           </t>
        </template>
添加支持翻译的源码:
<report id="action_todo_model_report_translated"
           string="Translated To-do special"
           model="todo.task"
           report_type="qweb-pdf"
           name="todo_report.report_todo_model_translated"
           paperformat="paperformat_euro_landscape"
        />
        <template id="report_todo_model_translated">
                <t t-call="todo_report.report_todo_task_special"
                 t-lang="user.lang" >
                    <t t-set="docs"
                   t-value="docs" />
                </t>
        </template>
最后导出翻译PO文件。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|技术支持|开发手册|Odoo中文网-远鼎旗下odoo培训网站 ( 苏ICP备15039516号 )

GMT+8, 2024-4-19 15:48 , Processed in 0.010443 second(s), 10 queries , Xcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表