Odoo 10 报告 table foreach line

Odoo 10 report table foreach line

这是python代码:

@api.depends('employee_id')
    def create_employee_report(self):
        count = 0
        employee_data = {}
        for employee in self.env['hr.employee'].search([]):
            if employee.socialsecurityno:
                count = count + 1
                employee_data ={'sira':str(count),'sigortano':str(employee.socialsecurityno)}
        return employee_data

和view.xml

    <tbody>
    <tr t-foreach="o.create_employee_report()" t-as="t">
      <td class="td-lrbotborder">
        <span t-field="t.sira" style=" font-size:13px;" />
      </td>
    <tr>

这里是错误信息:

Error to render compiling AST
AttributeError: 'str' object has no attribute '_fields'
Template: hr_module.sosyal_sigorta_report_document
Path: /templates/t/t/div/div/div/div[11]/table/tbody/tr/td[1]/span
Node: <span t-field="t.sira" style=" font-size:13px;"/>

我将如何使用 t-foreach?我正在尝试创建 table 列和行。这部分会填线,但我做不到。

t-field 更改为 t-esc 并将 t.sira 更改为t_value 例子:

 <tr t-foreach="o.create_employee_report()" t-as="t">
  <td class="td-lrbotborder">
      <span t-esc="t_value" style=" font-size:13px;" />
  </td>
</tr>

这是我的xml;

<table class="table table-condensed" style="width: 100%; border-collapse: collapse;">
        <thead>
            <tr>
                <th class="td-allborder" style="width:30px; font-size:11px;">Sıra</th>
                <th class="td-topbotborder" style="width:75px; font-size:10px;">Sigortalı No.</th>
            </tr>
        </thead>
        <tbody>
            <tr t-foreach="o.create_employee_report()" t-as="t">
                <td class="td-lrbotborder">
                    <span t-esc="t_value" style=" font-size:13px;" />
                </td>
                <td class="td-botborder">
                    <span t-esc="t_value" style=" font-size:13px;" />
            </tr>
        </tbody>
    </table>

这是 python 文件;

@api.depends('employee_id')
    def create_employee_report(self):
        count = 0
        employee_list = []
        employee_data = {}
        for employee in self.env['hr.employee'].search([]):
            if employee.socialsecurityno:
                employee_data ={'sira':str(count),
                                'sigortano':str(employee.socialsecurityno),
                                'kimlikno':str(employee.personelno),
                                'isim':employee.name}
                count = count + 1
                employee_list.append(employee_data)
        print employee_list
        return employee_list

编辑:我解决了这个问题;

<span t-esc="t['sira']" style=" font-size:13px;" />

感谢您的回复。