~ubuntu-branches/ubuntu/vivid/tryton-modules-sale-shipment-cost/vivid-proposed

« back to all changes in this revision

Viewing changes to sale.py

  • Committer: Package Import Robot
  • Author(s): Mathias Behrle
  • Date: 2014-10-21 20:24:26 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20141021202426-k4kn6l0f3spz164e
Tags: 3.4.0-1
* Updating signing key while using now plain .asc files instead of .pgp
  binaries.
* Adding actual upstream signing key.
* Updating to Standards-Version: 3.9.6, no changes needed.
* Merging upstream version 3.4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
                with Transaction().set_context(
161
161
                        shipment.get_carrier_context()):
162
162
                    cost, currency_id = self.carrier.get_sale_price()
163
 
                with Transaction().set_user(0, set_context=True):
164
 
                    Shipment.write([shipment], {
165
 
                            'carrier': self.carrier.id,
166
 
                            'cost': cost,
167
 
                            'cost_currency': currency_id,
168
 
                            })
 
163
                Shipment.write([shipment], {
 
164
                        'carrier': self.carrier.id,
 
165
                        'cost': cost,
 
166
                        'cost_currency': currency_id,
 
167
                        })
169
168
        return shipments
170
169
 
171
170
    def _get_invoice_line_sale_line(self, invoice_type):
185
184
        if (invoice
186
185
                and invoice_type == 'out_invoice'
187
186
                and self.shipment_cost_method == 'shipment'):
188
 
            with Transaction().set_user(0, set_context=True):
189
 
                invoice = Invoice(invoice.id)
190
187
            for shipment in self.shipments:
191
188
                if (shipment.state == 'done'
192
189
                        and shipment.carrier
200
197
                    Shipment.write([shipment], {
201
198
                            'cost_invoice_line': invoice_line.id,
202
199
                            })
203
 
            with Transaction().set_user(0, set_context=True):
204
 
                Invoice.update_taxes([invoice])
 
200
            Invoice.update_taxes([invoice])
205
201
        return invoice
206
202
 
207
203