_store_function dictionary does not get updated when field changes its type from function to any other storable!

Bug #552386 reported by Jean-Sebastien SUZANNE - http://www.Syleam.fr on 2010-03-31
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Fix Released
Vinay Rana (OpenERP)

Bug Description

Server revno: 2017
Addons revno: 2680
Client revno:


In the attachement there a module to test this bug. the module function2float change the field type of the field
'price_subtotal' of account_invoice_line.
price_subtotal is a field.function and a i want a field float. When you make a create or a write on the field, orm call
the 'get' method or a field float hasn't got a implemented get method.

install my module whitout demo, make a invoice and add it a invoice line and save the invoice

[2010-03-31 09:27:06,537] ERROR:web-services:[01]:
[2010-03-31 09:27:06,537] ERROR:web-services:[02]: Environment Information :
[2010-03-31 09:27:06,538] ERROR:web-services:[03]: System : Linux-2.6.31-20-generic-i686-with-Ubuntu-9.10-karmic
[2010-03-31 09:27:06,538] ERROR:web-services:[04]: OS Name : posix
[2010-03-31 09:27:06,538] ERROR:web-services:[05]: Distributor ID: Ubuntu
[2010-03-31 09:27:06,538] ERROR:web-services:[06]: Description: Ubuntu 9.10
[2010-03-31 09:27:06,539] ERROR:web-services:[07]: Release: 9.10
[2010-03-31 09:27:06,539] ERROR:web-services:[08]: Codename: karmic
[2010-03-31 09:27:06,539] ERROR:web-services:[09]: Operating System Release : 2.6.31-20-generic
[2010-03-31 09:27:06,539] ERROR:web-services:[10]: Operating System Version : #58-Ubuntu SMP Fri Mar 12 05:23:09 UTC 2010
[2010-03-31 09:27:06,539] ERROR:web-services:[11]: Operating System Architecture : 32bit
[2010-03-31 09:27:06,540] ERROR:web-services:[12]: Operating System Locale : fr_FR.UTF8
[2010-03-31 09:27:06,540] ERROR:web-services:[13]: Python Version : 2.6.4
[2010-03-31 09:27:06,540] ERROR:web-services:[14]: OpenERP-Server Version : 5.0.6
[2010-03-31 09:27:06,540] ERROR:web-services:[15]: Last revision No. & ID : 2017 <email address hidden>
[2010-03-31 09:27:06,540] ERROR:web-services:[16]:
[2010-03-31 09:27:06,540] ERROR:web-services:[17]: Traceback (most recent call last):
[2010-03-31 09:27:06,541] ERROR:web-services:[18]: File "/home/alnjssuza/Projets/clients/tiny/5.0/server/bin/osv/osv.py", line 59, in wrapper
[2010-03-31 09:27:06,541] ERROR:web-services:[19]: return f(self, dbname, *args, **kwargs)
[2010-03-31 09:27:06,541] ERROR:web-services:[20]: File "/home/alnjssuza/Projets/clients/tiny/5.0/server/bin/osv/osv.py", line 118, in execute
[2010-03-31 09:27:06,541] ERROR:web-services:[21]: res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
[2010-03-31 09:27:06,541] ERROR:web-services:[22]: File "/home/alnjssuza/Projets/clients/tiny/5.0/server/bin/osv/osv.py", line 110, in execute_cr
[2010-03-31 09:27:06,542] ERROR:web-services:[23]: return getattr(object, method)(cr, uid, *args, **kw)
[2010-03-31 09:27:06,542] ERROR:web-services:[24]: File "/home/alnjssuza/Projets/clients/tiny/5.0/server/bin/osv/orm.py", line 2696, in create
[2010-03-31 09:27:06,542] ERROR:web-services:[25]: self.pool.get(object)._store_set_values(cr, user, ids, fields2, context)
[2010-03-31 09:27:06,542] ERROR:web-services:[26]: File "/home/alnjssuza/Projets/clients/tiny/5.0/server/bin/osv/orm.py", line 2770, in _store_set_values
[2010-03-31 09:27:06,543] ERROR:web-services:[27]: result = self._columns[f].get(cr, self, ids, f, uid, context=context)
[2010-03-31 09:27:06,543] ERROR:web-services:[28]: File "/home/alnjssuza/Projets/clients/tiny/5.0/server/bin/osv/fields.py", line 100, in get
[2010-03-31 09:27:06,543] ERROR:web-services:[29]: raise Exception(_('undefined get method !'))
[2010-03-31 09:27:06,543] ERROR:web-services:[30]: Exception: undefined get method !


Distribution: Ubuntu
Version: 9.10 (karmic)
Python 2.6.4


Regards Jean-Sébastien

Related branches

Changed in openobject-server:
assignee: nobody → vra (openerp) (vra-openerp)

Hello Jean-Sebastien SUZANNE - http://www.Syleam.fr,

Thank you very much for pointing this out.

Would you please apply the following patch and update the module again and check?


Changed in openobject-server:
status: New → Confirmed
summary: - BUG to change a fields.function to a fields.float
+ _store_function dictionary does not get updated when field changes its
+ type from function to any other storable!
Changed in openobject-server:
importance: Undecided → High
milestone: none → 5.0.9
Changed in openobject-server:
milestone: 5.0.9 → 5.0.10
Changed in openobject-server:
status: Confirmed → In Progress

Hello Jean-Sebastien SUZANNE,

Would you please spend your precious time for this thread?
We are waiting for your reply.


Hello Jay

Sorry for my late answer. I applied the patch on my server.

But with the same example, I have again the same error.


Hello Jean-Sébastien,

I would like to interrupt you here that you cannot supply store=False to the float field.

 'price_subtotal': fields.float('Total Amount', help="Sous-total de la ligne à comptabiliser", digits=(16,2), , readonly=False, required=True).

Is good.

Remove method=False, store=False from your columns.

Earlier this field was storable.

Kindly check again.
I will revert back to you after rechecking this.


Hello Jean-Sébastien,

I forgot to mention that, you should have updated the module after applying the patch.

Hope this helps.

Till then, I'm working on an optimized patch.


Hello Jay

It's good for me. thank for all good job


Hello Jean-Sébastien,
Thank you for the feedback.
More optimized patch has been applied by revision 2037 <email address hidden>.

Changed in openobject-server:
status: In Progress → Fix Released
Eric Vernichon (eric-vernichon) wrote :


This patch not working if the field function contains store function with an object not equal to the object containing the field function

For example

        'amount_untaxed': fields.function(_amount_all, method=True, digits=(16, int(config['price_accuracy'])), string='Untaxed Amount',
            store = {
                'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
                'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10),

only the first function is removed in _store_function


To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers