0

I have an integer field in which i just display a value calculated with an 'on_change' function.

Is there anyway to not store that value in my Database(another way than using a function field)?

I also tried to put store=False but i guess it doesn't work with an integer field

here's my integer field:

'quantite_op': fields.integer('Quantité produite par opération',store=False,readonly=True),

And the onchange function:

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}

Thanks

soukainas
  • 49
  • 1
  • 9

1 Answers1

0

you will always have that field in your db, except it's a non-stored functional field. but you can manipulate the create or write methods of the model. you can set your integer field on None resp. False in that methods, so no value will be stored in that db column.

CZoellner
  • 13,553
  • 3
  • 25
  • 38
  • 1
    Thank you for your reply.not only i don't want it to be stored but i don't want neither that the column to be created in the database. I think i'll just create a function_field and call the related function in the onchange function. still working on it but i guess it'll do it. – soukainas Mar 04 '14 at 10:12