openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #04622
[Bug 913315] Re: sparse-field-akretion-integrity - Magento Fields bug
=== modified file 'bin/osv/fields.py'
--- bin/osv/fields.py 2011-12-13 08:47:16 +0000
+++ bin/osv/fields.py 2012-01-08 01:20:48 +0000
@@ -785,6 +785,11 @@
self._symbol_set=('%s', lambda x: ('%.'+str(t[1])+'f') % (__builtin__.float(x or 0.0),))
self.digits = t
+ def _make_tuple(self, cr, uid, obj, field, value, context=None):
+ obj_model = obj.pool.get(obj._columns[field].relation)
+ dict_names = dict(obj_model.name_get(cr, uid, [value], context))
+ return value, dict_names[value]
+
def postprocess(self, cr, uid, obj, field, value=None, context=None):
if context is None:
context = {}
@@ -793,10 +798,10 @@
if field_type == "many2one":
# make the result a tuple if it is not already one
if isinstance(value, (int,long)) and hasattr(obj._columns[field], 'relation'):
- obj_model = obj.pool.get(obj._columns[field].relation)
- dict_names = dict(obj_model.name_get(cr, uid, [value], context))
- result = (value, dict_names[value])
-
+ # obj_model = obj.pool.get(obj._columns[field].relation)
+ # dict_names = dict(obj_model.name_get(cr, uid, [value], context))
+ # result = (value, dict_names[value])
+ result = self._make_tuple(cr, uid, obj, field, value, context=context)
return result
def search(self, cr, uid, obj, name, args, context=None):
@@ -805,6 +810,14 @@
return []
return self._fnct_search(obj, cr, uid, obj, name, args, context=context)
+ def _get_multi(self, cr, uid, obj, id, data, context=None):
+ res = {}
+ for field, value in data.iteritems():
+ if value:
+ res[field] = self.postprocess(cr, uid, obj, field, value, context)
+ return res
+
+
def get(self, cr, obj, ids, name, user=None, context=None, values=None):
if context is None:
context = {}
@@ -819,9 +832,10 @@
if self._type == "many2one" :
for id in ids:
if self._multi and id in res:
- for field, value in res[id].iteritems():
- if value:
- res[id][field] = self.postprocess(cr, user, obj, field, value, context)
+ res[id].update(self._get_multi(cr, user, obj, id, res[id], context=context))
+ # for field, value in res[id].iteritems():
+ # if value:
+ # res[id][field] = self.postprocess(cr, user, obj, field, value, context)
elif res.get(id):
res[id] = self.postprocess(cr, user, obj, name, res[id], context)
return res
@@ -1020,6 +1034,22 @@
return read_value
return value
+ def _make_tuple(self, cr, uid, obj, field, value, context=None):
+ obj_model = obj.pool.get(obj._columns[field].relation)
+ dict_names = dict(obj_model.name_get(cr, uid, [value], context))
+ if not dict_names:
+ return
+ return value, dict_names[value]
+
+ def _get_multi(self, cr, uid, obj, id, data, context=None):
+ res = super(sparse, self)._get_multi(cr, uid, obj, id, data, context=context)
+ # Integrity check
+ for field, value in data.iteritems():
+ if value and res.get(field) is None:
+ res.pop(field, None)
+ obj.write(cr, uid, id, {field: False}, context=context)
+ return res
+
--
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/913315
Title:
sparse-field-akretion-integrity - Magento Fields bug
Status in OpenERP Server:
New
Bug description:
Hi,
I am not sure on this so please confirm. I backported to 6.0, the most recent fix for the serialization field here,
https://code.launchpad.net/~c2c/openobject-server/trunk-sparse-field-akretion-integrity/+merge/86044
It indeed fixed the problem where (magento) product export was not
possible, and where you could not open magento fields. The issue is
this.
When I import products from the website it correctly fills the
attributes like visibility, tax class and so-on. I can open fields
great, and export. The issue is that I cannot alter the values at all.
If I click on list view, there are no options available, no
selections, and I cannot create one. See attached video
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/913315/+subscriptions
References