stored function fields don't get updated on unlink() if the trigger is the same object (5.0)
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) | Status tracked in Trunk | |||||
| 5.0 |
Triaged
|
Undecided
|
Jay Vora (Serpent Consulting Services) | ||
| Trunk |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Hi!
5.0 latest bzr.
Stored function fields that calculate values depending on other records from the same object, don't get updated on unlink().
Example code:
'internal': fields.
}),
Here, _get_orderpoints() won't be called on unlink() because of the following code in orm.orm.unlink():
for order, object, store_ids, fields in result_store:
if object != self._name:
Related branches
Dukai Gábor (gdukai) wrote : | #1 |
I think this should receive high or at least medium importance. Function fields are too important on the ORM so we need to be sure they work properly.
Vinay Rana (OpenERP) (vra-openerp) wrote : | #3 |
Hello,
I have checked this issue in current latest updated code and your specified function is called at the time of unlink the related record.
Thanks.
I forgot to mention that the example field is in the stock.warehouse .orderpoint class. Here's the whole code: _orderpoint( osv.osv) : warehouse. orderpoint'
class stock_warehouse
_inherit = 'stock.
def _is_internal(self, cr, uid, ids, name, args, context=None):
res[ op.id] = False
proc_ loc_id = op.location_ id.procurement_ location_ id
parent_ ids = self.search(cr, uid, [
('location_ id', '=', proc_loc_id.id),
('product_ id', '=', op.product_id.id)])
res[op. id] = True
res = {}
for op in self.browse(cr, uid, ids, context=context):
if parent_ids:
return res
def _get_orderpoint s(self, cr, uid, ids, context):
prod_ ids.add( op.product_ id.id)
prod_ids = set()
for op in self.browse(cr, uid, ids):
return self.search(cr, uid, [('product_id', 'in', list(prod_ids))])
def _get_locations( self, cr, uid, ids, context): get('stock. warehouse. orderpoint' )\
.search( cr, uid, [('location_id', 'in', ids)])
return self.pool.
_columns = { function( _is_internal, method=True, type='boolean',
string= 'Internal' , store={
'stock. warehouse. orderpoint' :
( _get_orderpoint s, ['location_id'], 10),
'stock. location' : (_get_locations, ['procurement_ location_ id'], 20),
#bug: deleting an orderpoint won't trigger recalculation of the
#other orderpoints with the same product_id
'internal': fields.
}),
}