Неподдерживаемый тип(ы) операнда(ов) для *: 'decimal.Decimal' и 'float'
Здесь я использую Django 3.0 и python 3.7
Вот мой views.py
def update_stock_arriving_item(request, order_item_id):
...
...
def _convert(from_currency, to_currency, price):
custom_rate_obj = client.custom_rates.filter(currency=to_currency).first()
if custom_rate_obj is None or custom_rate_obj.exchange_rate in (0, None):
custom_rate_obj = ExchangeRates.objects.latest('created')
return custom_rate_obj.convert(from_currency, to_currency, price)
...
...
if client.horticulture and val:
purchase_price = _convert(obj.currency, 'GBP', float(item_price))
if obj.form_bought_in == 'CT':
val = 2.5
elif obj.form_bought_in == 'BR' or obj.form_bought_in == 'RB':
val = 3.5
else:
val = 0.0
trade_price = math.ceil(_convert(obj.currency, client.currency, float(item_price)) * val)
retail_price = trade_price * 1.35
PricingModule.objects.filter(
client=client, item=obj).update(
purchase_price=purchase_price,
trade_price=trade_price,
retail_price=retail_price
)
Как я могу решить проблему "неподдерживаемый тип(ы) операнда для *: 'decimal.Decimal' и 'float' "