~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to msf_outgoing/report/labels.py

  • Committer: Quentin THEURET
  • Date: 2016-03-04 12:15:00 UTC
  • Revision ID: qt@tempo-consulting.fr-20160304121500-u2ay8zrf83ih9fu3
US-826 [IMP] Change the way to check if products is not consistent on add multiple line wizard

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
        super(labels, self).__init__(cr, uid, name, context=context)
30
30
        self.localcontext.update({
31
31
            'time': time,
32
 
            'get_selection': self.get_selection,
33
32
            'range': range,
34
33
        })
35
34
           
42
41
                raise osv.except_osv(_('Warning !'), _('Labels are only available for completed Pre-Packing List Objects!'))
43
42
        
44
43
        return super(labels, self).set_context(objects, data, ids, report_type=report_type)
45
 
        
46
 
    def get_selection(self, o, field):
47
 
        """
48
 
        Returns the fields.selection label
49
 
        """
50
 
        sel = self.pool.get(o._name).fields_get(self.cr, self.uid, [field])
51
 
        res = dict(sel[field]['selection']).get(getattr(o,field),getattr(o,field))
52
 
        name = '%s,%s' % (o._name, field)
53
 
        tr_ids = self.pool.get('ir.translation').search(self.cr, self.uid, [('type', '=', 'selection'), ('name', '=', name),('src', '=', res)])
54
 
        if tr_ids:
55
 
            return self.pool.get('ir.translation').read(self.cr, self.uid, tr_ids, ['value'])[0]['value']
56
 
        else:
57
 
            return res
58
44
 
59
45
report_sxw.report_sxw('report.labels', 'stock.picking', 'addons/msf_outgoing/report/labels.rml', parser=labels, header=False)