Odoo中文网|Odoo实施培训

标题: 为报告添加支持翻译 [打印本页]

作者: 磨叽什么    时间: 2018-4-24 10:25
标题: 为报告添加支持翻译
报告源码:
<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文件。





欢迎光临 Odoo中文网|Odoo实施培训 (http://www.chinaodoo.net/) Powered by Discuz! X3.2