Hello,

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),
            },
            multi='sums'),


only the first function is removed in _store_function

Thanks.

-- 
You received this bug notification because you are a member of OpenERP
CTP, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/552386

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

Status in OpenERP Server:
  Fix Released

Bug description:
  Server revno: 2017
  Addons revno: 2680
  Client revno: 

  Hi

  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

  --------------8<---------------8<-------------
  [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 protected]
  [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 !

  --------------8<---------------8<-------------

  Distribution: Ubuntu
  Version: 9.10 (karmic)
  Python 2.6.4

  Locale:
    LANG=fr_FR.UTF-8

  
  Regards Jean-Sébastien

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/552386/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to