[FIX] delivery_hibou: context on button inside tree view for cancel, price can be Decimal

This commit is contained in:
Jared Kipe
2021-10-04 14:09:18 -07:00
parent 37c7822426
commit 492ecd60f6

View File

@@ -12,7 +12,12 @@ class StockQuantPackage(models.Model):
picking_id = self._context.get('active_id')
picking_model = self._context.get('active_model')
if not picking_id or picking_model != 'stock.picking':
raise UserError('Cannot cancel package other than through shipment/picking.')
params = self._context.get('params')
if params:
picking_id = params.get('id')
picking_model = params.get('model')
if not picking_id or picking_model != 'stock.picking':
raise UserError('Cannot cancel package other than through shipment/picking.')
return self.env['stock.picking'].browse(picking_id)
def send_to_shipper(self):
@@ -116,7 +121,7 @@ class StockPicking(models.Model):
res = res[0]
if carrier.free_over and self.sale_id and self.sale_id._compute_amount_total_without_delivery() >= carrier.amount:
res['exact_price'] = 0.0
carrier_price = res['exact_price'] * (1.0 + (self.carrier_id.margin / 100.0))
carrier_price = float(res['exact_price']) * (1.0 + (self.carrier_id.margin / 100.0))
carrier_prices.append(carrier_price)
tracking_number = ''
if res['tracking_number']: