I am trying to store the products function fields in DB. Using "store=True" attribute to save the value in DB, that has updated my table structure but the function field value hasn't updated in table. Look out my code below:
class product_product(osv.osv):
_inherit = 'product.product'
def _get_product_available_func(states, what):
def _product_available(self, cr, uid, ids, name, arg, context=None):
return {}.fromkeys(ids, 0.0)
return _product_available
_product_qty_available = _get_product_available_func(('done',), ('in', 'out'))
_product_outgoing_qty = _get_product_available_func(('confirmed','waiting','assigned'), ('out',))
_product_incoming_qty = _get_product_available_func(('confirmed','waiting','assigned'), ('in',))
_columns = {
'qty_available': fields.function(_product_qty_available, type='float', store=True, string='Quantity On Hand'),
'incoming_qty': fields.function(_product_incoming_qty, type='float', store=True, string='Incoming'),
'outgoing_qty': fields.function(_product_outgoing_qty, type='float', store=True, string='Outgoing'),
}
product_product()
Please help me to store the value in DB whenever i am updating.