Subvention -> Réduction + units for kfet_config

- kfet_config gives "reduction_cof" as editable instead of
  "subvention_cof"
- this last one can still be accessed via kfet_config (computed from
  new "reduction_cof"
- add units to numeric values of kfet_config form
This commit is contained in:
Aurélien Delobelle 2017-04-10 11:36:06 +02:00
parent e89ff68d3b
commit c228416809
3 changed files with 21 additions and 6 deletions

View file

@ -21,7 +21,13 @@ def adapt_settings(apps, schema_editor):
except Settings.DoesNotExist:
pass
try_get('kfet_subvention_cof', 'SUBVENTION_COF', 'value_decimal')
try:
subvention = obj.get(name='SUBVENTION_COF').value_decimal
subvention_mult = 1 + subvention/100
reduction = (1 - 1/subvention_mult) * 100
cfg['kfet_reduction_cof'] = reduction
except Settings.DoesNotExist:
pass
try_get('kfet_addcost_amount', 'ADDCOST_AMOUNT', 'value_decimal')
try_get('kfet_addcost_for', 'ADDCOST_FOR', 'value_account')
try_get('kfet_overdraft_duration', 'OVERDRAFT_DURATION', 'value_duration')