@Ivan : To Explain more my situation : First of all, I created the functionnal field without the store parameter (i forgot), it's on stock.picking.out model, (stock_picking table). Then, users created "delivery orders", so this functionnal field has computed values. So, right now, when I add the store parameter, into the functionnal field "amount_bl" for example, it raises error : ProgrammingError: column stock_picking.amount_bl does not exist LINE 1: ...stock_picking."num_bl",stock_picking."commercial",stock_pick...
I wonder if that error comes from the fact that users have already created delivery orders, and does not find where to store it.? (a supposition).
EDITED ANWSER :
@Ivan : When updating the module an error raises :
File "/opt/openerp/server/openerp/addons/add_bl_valcr/stock.py", line 23, in _amount_order so_record = self.pool.get('sale.order').browse(cr, uid, so_id, context=None) AttributeError: 'NoneType' object has no attribute 'browse'
It's related the function of the field, here is the code :
class StockPickingOut(orm.Model):
_inherit = 'stock.picking.out'
_name = 'stock.picking.out'
def _amount_order(self, cr, uid, ids, amount_bl, arg, context):
res = {}
for picking in self.browse(cr, uid, ids, context):
res[picking.id] = 0.0
origin = picking.origin
cr.execute("SELECT ID FROM SALE_ORDER WHERE NAME='%s' AND ID IS NOT NULL" %(origin))
so = cr.fetchone()
if so:
so_id = so[0]
so_record = self.pool.get('sale.order').browse(cr, uid, so_id, context=None)
amount = so_record.amount_total
res[picking.id] = amount
return res
I think it has a relation with the fact that old none stored values have been deleted.
So what I did, it's ignoring this error, and updating the module, So now the functionnal field is empty.
Just to explain more what the function does, it just pull the amount of the sale order, and put it on the delivery order. I don't know now after putting store=True, it's not working properly (supposition).
I'm now working to improve the code of my functionnal field, I'll let you know of my results.
Many thanks Ivan.