From b94ce8b0d1f0bb3030f57edec1438ef74f481e2b Mon Sep 17 00:00:00 2001 From: Saran440 Date: Thu, 1 Aug 2024 18:19:26 +0700 Subject: [PATCH] [FIX] budget_control: flush module when precommit for check budget --- budget_control/models/budget_period.py | 2 ++ budget_control/views/account_move_views.xml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/budget_control/models/budget_period.py b/budget_control/models/budget_period.py index 6d9105dc..ebde2247 100644 --- a/budget_control/models/budget_period.py +++ b/budget_control/models/budget_period.py @@ -260,6 +260,8 @@ def check_budget_precommit(self, doclines, doc_type="account"): budget_move = line.with_context(force_commit=True).commit_budget() if budget_move: budget_moves.append(budget_move) + # Update database, so we can check budget with query + budget_move.flush_model() # Check Budget self.env["budget.period"].check_budget(doclines, doc_type=doc_type) # Remove commits diff --git a/budget_control/views/account_move_views.xml b/budget_control/views/account_move_views.xml index 910b0370..6e94e4e9 100644 --- a/budget_control/views/account_move_views.xml +++ b/budget_control/views/account_move_views.xml @@ -53,6 +53,7 @@ string="Budget Figure" width="10px" widget="popover_widget" + attrs="{'invisible': [('analytic_distribution', '=', False)]}" groups="budget_control.group_budget_control_user" /> @@ -84,6 +85,7 @@ string="Budget Figure" width="10px" widget="popover_widget" + attrs="{'invisible': [('analytic_distribution', '=', False)]}" groups="budget_control.group_budget_control_user" />