mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
37 lines
1.7 KiB
Diff
37 lines
1.7 KiB
Diff
diff -r 447a58b54f0d trytond/trytond/modules/sale_shipment_cost/sale.py
|
|
--- a/trytond/trytond/modules/sale_shipment_cost/sale.py Mon Nov 02 16:19:34 2015 +0100
|
|
+++ b/trytond/trytond/modules/sale_shipment_cost/sale.py Fri Sep 16 12:08:12 2016 +0200
|
|
@@ -126,22 +126,16 @@
|
|
cost_line.unit_price = cost_line.amount = cost
|
|
return cost_line
|
|
|
|
- def create_shipment(self, shipment_type):
|
|
- Shipment = Pool().get('stock.shipment.out')
|
|
-
|
|
- shipments = super(Sale, self).create_shipment(shipment_type)
|
|
- if shipment_type == 'out' and shipments and self.carrier:
|
|
- for shipment in shipments:
|
|
- shipment.carrier = self.carrier
|
|
- with Transaction().set_context(
|
|
- shipment.get_carrier_context()):
|
|
- cost, currency_id = self.carrier.get_sale_price()
|
|
- Shipment.write([shipment], {
|
|
- 'carrier': self.carrier.id,
|
|
- 'cost': cost,
|
|
- 'cost_currency': currency_id,
|
|
- })
|
|
- return shipments
|
|
+ def _get_shipment_sale(self, Shipment, key):
|
|
+ shipment = super(Sale, self)._get_shipment_sale(Shipment, key)
|
|
+ if shipment.__name__ == 'stock.shipment.out' and self.carrier:
|
|
+ shipment.carrier = self.carrier
|
|
+ with Transaction().set_context(
|
|
+ shipment.get_carrier_context()):
|
|
+ cost, currency_id = self.carrier.get_sale_price()
|
|
+ shipment.cost = cost
|
|
+ shipment.cost_currency = currency_id
|
|
+ return shipment
|
|
|
|
def _get_invoice_line_sale_line(self, invoice_type):
|
|
result = super(Sale, self)._get_invoice_line_sale_line(invoice_type)
|