如何在openerp中不存储整数字段
我有一个整数字段,其中我只显示一个用“on_change”函数计算的值 是否存在不在数据库中存储该值的方法(使用函数字段的另一种方法) 我还尝试将store=False设置为False,但我想它对整数字段不起作用 这是我的整数字段:如何在openerp中不存储整数字段,openerp,openerp-7,Openerp,Openerp 7,我有一个整数字段,其中我只显示一个用“on_change”函数计算的值 是否存在不在数据库中存储该值的方法(使用函数字段的另一种方法) 我还尝试将store=False设置为False,但我想它对整数字段不起作用 这是我的整数字段: 'quantite_op': fields.integer('Quantité produite par opération',store=False,readonly=True), 以及onchange函数: def onchange_num_of(self,c
'quantite_op': fields.integer('Quantité produite par opération',store=False,readonly=True),
以及onchange函数:
def onchange_num_of(self,cr,uid,ids,of_num,operation_nom,quantite,context=None):
res = {}
if of_num:
ordre_f = self.pool.get('ordres_fabrication').browse(cr, uid,of_num,context=context)
res['delai_of'] =ordre_f.delai
res['quantite_of'] =ordre_f.quantite
if operation_nom:
record =self.search(cr, uid, [('of_num','=',of_num),('operation_nom','=',operation_nom)])
qte=0
for item in record:
prod = self.browse(cr, uid,item,context=context)
qte += prod.quantite
res['quantite_op'] = qte+quantite
return {'value': res}
谢谢您的数据库中将始终包含该字段,除非它是非存储功能字段。但是您可以操纵模型的创建或写入方法。您可以在None resp上设置整数字段。该方法为False,因此该db列中不会存储任何值。感谢您的回复。我不仅不希望存储该值,而且也不希望在数据库中创建该列。我想我只需要创建一个function_字段并调用onchange函数中的相关函数。还在努力,但我想它会成功的。