如何在Odoo中按计算字段进行搜索? V9

时间:2018-07-26 20:16:24

标签: odoo-9 computed-field

@api.multi
def _compute_product_description(self):
    def get_parent_move(move):
        if move.move_dest_id:
            return get_parent_move(move.move_dest_id)
        return move

    for production in self:
        if production.move_prod_id:
            move = get_parent_move(production.move_prod_id)
            production.product_description = move.procurement_id and move.procurement_id.sale_line_id and move.procurement_id.sale_line_id.name or ''

product_description = fields.Char(string='Product description', compute='_compute_product_description', search='_description_search')

但是,当我开始寻找该字段时,我有一个无限的搜索循环。错了吗?

0 个答案:

没有答案