openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #10830
[Bug 989641] Re: column's priority attr has no effect in osv_memory
Hello huangjunwen ,
I have checked this issue with trunk. But I did not face any problem
with priority.So would you please check this again and
provide more information regarding this issue.
As per your bug description its working fine at my end.
I have attached video for your more reference.
Thanks and waiting for reply!
** Changed in: openobject-server
Status: New => Incomplete
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/989641
Title:
column's priority attr has no effect in osv_memory
Status in OpenERP Server:
Incomplete
Bug description:
I have a model that contains several function fields, they need to
compute in some order. If in osv.osv i can use the priority attribute
to force the compute order. But if it is a osv_memory, it seems that
they have no effect at all.
server: debian 2.6.32-5-686
oerp server installed by: openerp-server-6.0.2-0_all.deb
example code:
=================================
import netsvc
from osv import osv, fields
class MyObj(osv.osv):
def _get_col(self, cr, uid, ids, field_name, arg, context=None):
return dict(((id, '') for id in ids))
def _set_col(self, cr, uid, id, field_name, field_val, arg, context=None):
netsvc.Logger().notifyChannel('_set_col', netsvc.LOG_ERROR,
'setting %s to %s' % (field_name, field_val))
return True
_name = 'my.obj'
_columns = {
'col1': fields.function(_get_col, fnct_inv=_set_col, type='char',
size=32,
method=True,
priority=10,
string='Col1'),
'col2': fields.function(_get_col, fnct_inv=_set_col, type='char',
size=32,
method=True,
priority=11,
string='Col2'),
}
MyObj()
=================================
if running
pool.get('my.obj').write(cr, uid, ids, {'col1': '1', 'col2': '2'})
the log shows
[2012-04-27 07:14:54,471][openerp_db] ERROR:_set_col:setting col1 to 1
[2012-04-27 07:14:54,473][openerp_db] ERROR:_set_col:setting col2 to 2
but if it changes to
class MyObj(osv.osv_memory):
the log will show
[2012-04-27 07:16:46,545][openerp_db] ERROR:_set_col:setting col2 to 2
[2012-04-27 07:16:46,545][openerp_db] ERROR:_set_col:setting col1 to 1
After reading into the source code, i think this is because the 'write' method of 'orm_memory' lack a line as in 'orm':
upd_todo.sort(lambda x, y: self._columns[x].priority-self._columns[y].priority)
is it a bug?
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/989641/+subscriptions
References