fields.related on many2many field always indicate (0)

Bug #356628 reported by Christophe CHAUVET on 2009-04-06
Affects Status Importance Assigned to Milestone
Status tracked in Trunk
Won't Fix
OpenERP's Framework R&D

Bug Description

Server revno: 1755
Addons revno: 2267
Client revno: 949

On a new module, add fields.related to a many2many field.
Add this field on the tree view and a search form
the fields always indicate (0) all the times, thus there are a multi value on the original object.
See screenshot

Distribution: Ubuntu
Version: 8.10 (intrepid)
Python 2.5.2


Related branches

Hello Christophe,

Can you please send me your module?

I do not get the situation. My records are not saved even.


Changed in openobject-server:
assignee: nobody → jvo-openerp
Fabien (Open ERP) (fp-tinyerp) wrote :

related sields still does not support m2m.

Changed in openobject-server:
importance: Undecided → Wishlist

Hello, I changed the code in the /server/bin/osv/ and solved my problem

this was the function I changed:

    def _fnct_read(self, obj, cr, uid, ids, field_name, args, context=None):
        self._field_get2(cr, uid, obj, context)
        if not ids: return {}
        relation = obj._name
        res = {}.fromkeys(ids, False)
        objlst = obj.browse(cr, uid, ids)
        for data in objlst:
            if not data:
            t_data = data
            relation = obj._name
            for i in range(len(self.arg)):
                field_detail = self._relations[i]
                relation = field_detail['object']
                    if not t_data[self.arg[i]]:
                        t_data = False
                    t_data = False
                # Modificado por AMA para resolver o bug em que o one 2 many em related aparece apenas o ultimo valor
                if field_detail['type'] in ('one2many', 'many2many'):
                    all_t_data = t_data[self.arg[i]]
                    for t_data in all_t_data:
                    t_data = t_data[self.arg[i]]

            if type(t_data) == type(objlst[0]) and field_detail['type'] not in ('one2many', 'many2many'):
                res[] =
                res[] = t_data

            if field_detail['type'] in ('one2many', 'many2many'):
                if type(t_data) == type(objlst[0]):
                    res[] = t_data_list
                    res[] = t_data

        if self._type=='many2one':
            ids = filter(None, res.values())
            if ids:
                ng = dict(obj.pool.get(self._obj).name_get(cr, uid, ids, context=context))
                for r in res:
                    if res[r]:
                        res[r] = (res[r], ng[res[r]])
        return res

Setting the big as "Won't fix" for stable as it is really not a blocking point.
Thanks for your participation.

summary: - [5.0] fields.related on many2many field always indicate (0)
+ fields.related on many2many field always indicate (0)

Need to investigate if its really fixed on trunk or not.

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

Other bug subscribers