Usage of modifiers in 'direct' mappings filters the field out when using map_record.values(fields=[...])

Bug #1322645 reported by Guewen Baconnier @ Camptocamp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenERP Connector
Fix Released
Medium
Guewen Baconnier @ Camptocamp

Bug Description

With a mapper having a modifier:

        class MyMapper(ImportMapper):
            direct = [('field', 'field2'),
                            ('no_field', 'no_field2'),
                             (convert('name', int), 'out_name')]

And such a record:

        record = {'name': '300', 'field': 'value', 'no_field': 'no_value'}

When calling the mapper with the 'fields' option to filter the fields to map:

        mapper = MyMapper(env)
        map_record = mapper.map_record(record)
        map_record.values(fields=['field', 'name'])

Expected is:

    {'out_name': 300, 'field2': 'value'}

Actual result is:

     {'field2': 'value'}

Because 'name' is shadowed by the closure function.

Related branches

Changed in openerp-connector:
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Guewen Baconnier @ Camptocamp (gbaconnier-c2c)
Changed in openerp-connector:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.