~credativ/openobject-addons/elico-7.0-fixes-gap-analysis-template-management

« back to all changes in this revision

Viewing changes to base_intercompany/unit/binder.py

  • Committer:
  • Date: 2014-01-22 11:53:52 UTC
  • mfrom: (25.1.2 elico-7.0)
  • Revision ID: elicoidal@hotmail.com-20140122115352-sik353a094kvybc7
[FIX] several mapping bugs

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
##############################################################################
3
3
#
4
4
#    OpenERP, Open Source Management Solution
5
 
#    Copyright (c) 2010-2013 Elico Corp. All Rights Reserved.
 
5
#    Copyright (c) 2010-2014 Elico Corp. All Rights Reserved.
6
6
#    Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com>
7
7
#    Eric Caudal <eric.caudal@elico-corp.com>
8
8
 
86
86
        res = {}
87
87
        for icops in record.icops_ids:
88
88
            key = '%s_%s' % (icops.backend_id.id, icops.concept)
89
 
            res[key] = icops.record_id
 
89
            res[key] = {'id': icops.record_id}
90
90
        return res
91
91
 
92
92
    def bind(self, records, binding_id):
101
101
        if not records:
102
102
            return
103
103
        context = self.session.context.copy()
104
 
        context['connector_no_export'] = True
 
104
        context['icops'] = True
105
105
        now_fmt = datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT)
106
106
        icops_ids = []
107
107
        for record, record_id in records.items():
108
108
            backend_id, concept = record.split('_')
109
109
 
110
 
            icops_id = (0, 0, {'record_id': record_id,
 
110
            icops_id = (0, 0, {'record_id': record_id['id'],
111
111
                        'backend_id': backend_id,
112
112
                        'concept': concept,
113
 
                        'binding_id': binding_id})
 
113
                        'binding_id': binding_id,
 
114
                        'model': record_id['model']})
114
115
            icops_ids.append(icops_id)
115
116
 
116
117
        self.environment.model.write(