~opencrea/+junk/export-lerelais

« back to all changes in this revision

Viewing changes to invoice_weight/wizard/invoice_complement.py

  • Committer: joannes
  • Date: 2018-07-04 13:02:18 UTC
  • Revision ID: joannes@debian-20180704130218-tju3d7v837fg5shm
weight reductin on êrforma

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
            else:
61
61
                transitaire_fixed_amount = 0.0
62
62
 
63
 
            condition = [('partner_id', '=', order.partner_id.id), ('weight_reduction', '>', 0.0)]
64
 
            translat_ids = self.env['invoice.translate'].search(condition)
65
 
            if translat_ids:
66
 
                transitaire_weight_reduction = translat_ids[0].weight_reduction
 
63
 
 
64
 
 
65
            if not order.transitaire_weight_reduction:
 
66
                condition = [('partner_id', '=', order.partner_id.id), ('weight_reduction', '>', 0.0)]
 
67
                translat_ids = self.env['invoice.translate'].search(condition)
 
68
                if translat_ids:
 
69
                    transitaire_weight_reduction = translat_ids[0].weight_reduction
 
70
                else:
 
71
                    transitaire_weight_reduction = 0.0
67
72
            else:
68
 
                transitaire_weight_reduction = 0.0
 
73
                transitaire_weight_reduction = order.transitaire_weight_reduction
69
74
 
70
75
            if order.partner_id.agent_partner:
71
76
                agent_id = order.partner_id.agent_partner.id
148
153
            self.order_id.write({
149
154
                'order_transitaire_type': order_transitaire_type,
150
155
                'transitaire_fixed_amount': transitaire_fixed_amount,
151
 
                'transitaire_weight_reduction': transitaire_weight_reduction})
 
156
                'transitaire_weight_reduction': 1000.0 * transitaire_weight_reduction})
152
157
 
153
158
            self.order_id.button_compute_transitaire_line()
154
159