odoo - 如何显示计算出的 one2many 字段 Odoo(api v8)

标签 odoo

我想知道如何在 TreeView 中显示 one2many 计算字段,我尝试了以下代码但没有结果:

@api.one
def _compute_o2m_field(self):
    related_recordset = self.env["product.product"].search([])
    self.productos = related_recordset

products = fields.One2many(string="products", compute='_compute_o2m_field')

有什么想法吗? 谢谢

最佳答案

@api.one
def _compute_o2m_field(self):
    related_recordset = self.env["product.product"].search([])
    self.products = related_recordset.ids

products = fields.One2many('product.product','many2onefieldonproduct',string="products", compute='_compute_o2m_field')

关于odoo - 如何显示计算出的 one2many 字段 Odoo(api v8),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32512768/

相关文章:

python - 如何打印 EXCEL 格式的报告 (XLS)

python - 使用临时变量存储 super 返回值时出现奇怪的 super() 返回行为

python - odoo中以下情况如何添加相关字段?

security - odoo 8 中的implied_ids 和组中的用户

docker - 体积odoo。权限问题

python - Odoo报告错误: Qweb error maximum recursion depth exceeded

odoo - Install The Wkhtmltopdf Extension in Odoo 15 Package By Bitnami问题

python - Odoo安装 ''错误: [Errno 98] Address already in use''

python - View 找不到字段

postgresql - 恢复数据库后的odoo错误