account_invoice: Test both reverse operations to invalidate ratio and divisor

This commit is contained in:
Àngel Àlvarez 2020-01-20 13:16:11 +01:00
parent 77b8495282
commit da4645a3bf
2 changed files with 21 additions and 2 deletions

20
issue8966.diff Normal file
View File

@ -0,0 +1,20 @@
Index: payment_term.py
===================================================================
--- a/trytond/trytond/modules/account_invoice/payment_term.py
+++ b/trytond/trytond/modules/account_invoice/payment_term.py
@@ -222,11 +222,10 @@
gettext('account_invoice'
'.msg_payment_term_invalid_ratio_divisor',
line=line.rec_name))
- ratio = line.ratio
- divisor = line.divisor
- line.on_change_ratio()
- line.on_change_divisor()
- if (line.divisor != divisor) or (line.ratio != ratio):
+ if (line.ratio != round(
+ 1 / line.divisor, cls.ratio.digits[1])
+ and line.divisor != round(
+ 1 / line.ratio, cls.divisor.digits[1])):
raise PaymentTermValidationError(
gettext('account_invoice'
'.msg_payment_term_invalid_ratio_divisor',

3
series
View File

@ -42,5 +42,4 @@ issue7805.diff # [stock] [stock_lot_sled] Allow configuring which quantity is gr
issue8860.diff # [stock_forecast] stock_forecast does not spread all the quantities
statement_of_account.diff # [account] Cumulate balance of previous fiscal years
# issue8880_trytond.diff # [trytond] Position new record based on order
issue8966.diff # [account_invoice] suport 1/3 on payment_term