[UPD] Arround plan amount with coeff

If 100 <= amount_with_coef <  125, result = 100
If 125 <= amount_with_coef <  175, result = 150
If 175 <= amount_with_coef <= 200, result = 200
This commit is contained in:
Stéphan Sainléger
2022-05-24 16:32:02 +02:00
parent 4b5188bd06
commit af2bfdb0a5
2 changed files with 16 additions and 1 deletions

View File

@@ -3,7 +3,7 @@
{
"name": "account_budget_forecast",
"version": "13.0.1.2.0",
"version": "13.0.1.3.0",
"author": "Elabore",
"maintainer": "False",
"website": "False",

View File

@@ -290,6 +290,21 @@ class BudgetForecast(models.Model):
record.plan_amount_with_coeff = record.plan_amount_without_coeff * (
1 + record.analytic_id.global_coeff
)
modulo = record.plan_amount_with_coeff % 100
if (modulo > 0) and (modulo < 25):
record.plan_amount_with_coeff = record.plan_amount_with_coeff - modulo
elif (modulo >= 25) and (modulo < 50):
record.plan_amount_with_coeff = record.plan_amount_with_coeff + (
50 - modulo
)
elif (modulo > 50) and (modulo < 75):
record.plan_amount_with_coeff = record.plan_amount_with_coeff - (
modulo - 50
)
elif (modulo >= 75) and (modulo < 100):
record.plan_amount_with_coeff = record.plan_amount_with_coeff + (
100 - modulo
)
@api.depends("child_ids")
def _calc_plan_qty(self):