【问题标题】:How to count/sum the total rows of records in tree view of wizard in odoo 10如何在odoo 10中的向导树视图中计算/求和记录的总行数
【发布时间】:2018-11-08 18:18:11
【问题描述】:

我现在正在苦苦思考如何在向导的树形视图中计算总​​行数或记录数。

我的表单视图中有一个“手头”按钮,我手头按钮内有一个向导,如果您单击该按钮,它将触发一个有记录的向导。

我想要的是,在我的“手头”按钮中,我想显示该按钮内的记录总数。

非常感谢。

这是我手头上有一个按钮的表单视图。

这是包含该按钮内记录的向导。

在图片中,我有两条记录,我想将它显示在我手头的按钮中。

【问题讨论】:

  • 预先计算并添加到按钮中

标签: python python-2.7 treeview odoo-10 wizard


【解决方案1】:

您需要一个字段函数来计算记录中的总列表,例如这样。

@api.multi 
def _get_count_list(self):
        data_obj    = self.env['example.object']
        for data in self:       
               list_data        = data_obj.search([('Fill the condition')])
               data.example_count = len(list_data)

example_count = fields.Integer("Count", compute='_get_count_list')

【讨论】:

  • 你救了我。谢谢 :) 很大的帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-26
相关资源
最近更新 更多