OpenErp:如何按功能字段过滤销售订单?
问题描述:
我有一个小问题。OpenErp:如何按功能字段过滤销售订单?
我有一个向导,我有所有的销售订单,但我只需要那些有小于0(零)的余额。平衡字段是一个功能性字段,因此域不起作用。
任何ideeas如何我可以解决这个问题?我需要能够选择余额小于0的销售订单。
谢谢!
答
对于function
型或compute
的领域,你有两个选择:
1)要么给该领域的属性store=True
使得计算出的值保存在数据库
2),甚至更好地为您自己的search
将做搜索和应用域的方法。
你会怎么做以上取决于你使用的Odoo版本。请查看odoo/fields.py
关于现场课程的文档。使用的字段定义的搜索参数:
One can define a field whose value is computed instead of simply being read from the database. The attributes that are specific to computed fields are given below. To define such a field, simply provide a value for the attribute ``compute``. :param compute: name of a method that computes the field :param inverse: name of a method that inverses the field (optional) **:param search: name of a method that implement search on the field (optional)**
使用diferrent类型的商店解决。 – Dima