mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
issue11684 carrier_percentage Do not compute price if no currency is set
This commit is contained in:
parent
eb07260d19
commit
bbee5a337d
31
issue11684.diff
Normal file
31
issue11684.diff
Normal file
|
@ -0,0 +1,31 @@
|
|||
diff --git a/trytond/trytond/modules/carrier_percentage/carrier.py b/trytond/trytond/modules/carrier_percentage/carrier.py
|
||||
index 8cf58a3..d85ceb9 100644
|
||||
--- a/trytond/trytond/modules/carrier_percentage/carrier.py
|
||||
+++ b/trytond/trytond/modules/carrier_percentage/carrier.py
|
||||
@@ -30,8 +30,6 @@ class Carrier(metaclass=PoolMeta):
|
||||
Currency = Pool().get('currency.currency')
|
||||
|
||||
price = amount * self.percentage / Decimal(100)
|
||||
- if not currency_id:
|
||||
- return price, currency_id
|
||||
currency = Currency(currency_id)
|
||||
return currency.round(price), currency_id
|
||||
|
||||
@@ -40,7 +38,8 @@ class Carrier(metaclass=PoolMeta):
|
||||
if self.carrier_cost_method == 'percentage':
|
||||
amount = Transaction().context.get('amount', Decimal(0))
|
||||
currency_id = Transaction().context.get('currency', currency_id)
|
||||
- return self.compute_percentage(amount, currency_id)
|
||||
+ if currency_id is not None:
|
||||
+ return self.compute_percentage(amount, currency_id)
|
||||
return price, currency_id
|
||||
|
||||
def get_purchase_price(self):
|
||||
@@ -48,5 +47,6 @@ class Carrier(metaclass=PoolMeta):
|
||||
if self.carrier_cost_method == 'percentage':
|
||||
amount = Transaction().context.get('amount', Decimal(0))
|
||||
currency_id = Transaction().context.get('currency', currency_id)
|
||||
- return self.compute_percentage(amount, currency_id)
|
||||
+ if currency_id is not None:
|
||||
+ return self.compute_percentage(amount, currency_id)
|
||||
return price, currency_id
|
2
series
2
series
|
@ -125,3 +125,5 @@ issue11000.diff # [account]
|
|||
|
||||
issue11499.diff # [sao] Set FractionDigits options to format CSV to locale
|
||||
# issue11198.diff # [bank] Fill or create bank from IBAN and enforce uniqueness
|
||||
|
||||
issue11684.diff # [carrier_percentage] Do not compute price if no currency is set
|
||||
|
|
Loading…
Reference in a new issue