【发布时间】:2017-10-31 08:37:39
【问题描述】:
我正在尝试调用返回值的方法。我想获取这些值并在我的报告中使用它们。
@api.one
def check_month(self,record,res):
fd = datetime.strptime(str(record.from_date), "%Y-%m-%d")
for rec in record.sales_record_ids:
res.append(rec.jan_month)
@api.one
def get_sales_rec(self):
result=[]
target_records = self.env['sales.target'].search([('sales_team','=', self.sales_team_ids.id)])
for rec in target_records:
self.check_month(rec,result)
return result
像这样在 xml 中:
<tbody>
<tr t-foreach="get_sales_rec()" t-as="data">
<tr>
<td>
<span t-esc="data[0]" />
</td>
</tr>
</tr>
</tbody>
【问题讨论】:
-
首先检查您的 xml 报告是否正在获取您的任何 python 函数的值。因为如果它没有从任何函数中获取任何值,那么这可能是您提供给 xml 的 id 和您的特定 pyhton 文件的模型名称的问题。
-
我找到了@Heroic的帮助并解决了。
-
@ArsalanSherwani 如果您认为这是解决问题的方法,请将其标记为已接受
标签: python xml openerp odoo-10