~dorian-kemps/unifield-web/UW-4099

« back to all changes in this revision

Viewing changes to addons/openerp/controllers/impex.py

  • Committer: jf
  • Date: 2018-03-19 11:18:47 UTC
  • mfrom: (4910 unifield-web)
  • mto: This revision was merged to the branch mainline in revision 4911.
  • Revision ID: jfb@tempo-consulting.fr-20180319111847-94jm22t651yvbi0b
[MERGE] UF8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
412
412
                # the original domain for the view (for instance from SI: do not show Supplier Refunds nor DI)
413
413
                if 'original_domain' in ctx:
414
414
                    domain.extend(ctx['original_domain'])
 
415
                # take also into account the "Filters => New Filter(s)" which have been selected
 
416
                if 'new_filter_domain' in ctx:
 
417
                    domain.extend(ctx['new_filter_domain'])
415
418
            else:
416
419
                ids = params.ids or []
417
420
 
584
587
 
585
588
        #Inverting the header into column names
586
589
        try:
587
 
            res = rpc.session.execute('object', 'execute', params.model, 'import_data', fields, datas, 'init', '', False, ctx)
 
590
            res = rpc.session.execute('object', 'execute', params.model,
 
591
                    'import_data', fields, datas, 'init', '', False, ctx,
 
592
                    False, True, True)
588
593
        except Exception, e:
589
594
            error = {'message':ustr(e), 'title':_('XML-RPC error')}
590
595
            return self.imp(error=error, **kw)
593
598
        if res[0]>=0:
594
599
            return self.imp(success={'message':_('Imported %d objects') % (res[0],)}, **kw)
595
600
 
596
 
        d = ''
597
 
        for key,val in res[1].items():
598
 
            d+= ('%s: %s' % (ustr(key),ustr(val)))
599
 
        msg = _('Error trying to import this record:%s. ErrorMessage:%s %s') % (d,res[2],res[3])
 
601
        msg = _('Error trying to import this record: %r.\nErrorMessage:\n%s %s') % (res[1], res[2], res[3])
600
602
        error = {'message':ustr(msg), 'title':_('ImportationError')}
601
603
 
602
604
        return self.imp(error=error, **kw)