diff --git a/budget_control/models/budget_period.py b/budget_control/models/budget_period.py index 736891f5..45965c87 100644 --- a/budget_control/models/budget_period.py +++ b/budget_control/models/budget_period.py @@ -261,7 +261,8 @@ def check_budget_precommit(self, doclines, doc_type="account"): if budget_move: budget_moves.append(budget_move) # Update database, so we can check budget with query - budget_move.flush_model() + if budget_move: + budget_move.flush_model() # Check Budget self.env["budget.period"].check_budget(doclines, doc_type=doc_type) # Remove commits diff --git a/budget_control_expense/__manifest__.py b/budget_control_expense/__manifest__.py index 78d5293f..01722124 100644 --- a/budget_control_expense/__manifest__.py +++ b/budget_control_expense/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Budget Control on Expense", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "license": "AGPL-3", "author": "Ecosoft, Odoo Community Association (OCA)", "website": "https://github.com/ecosoft-odoo/budgeting", diff --git a/budget_control_expense/models/account_move_line.py b/budget_control_expense/models/account_move_line.py index 2f44d8a7..62718509 100644 --- a/budget_control_expense/models/account_move_line.py +++ b/budget_control_expense/models/account_move_line.py @@ -24,7 +24,8 @@ def uncommit_expense_budget(self): Expense = self.env["hr.expense"] for ml in self: inv_state = ml.move_id.state - if not ml.move_id.expense_sheet_id: + # Skip if not expense or tax line + if not ml.move_id.expense_sheet_id or ml.display_type == "tax": continue if inv_state == "posted": expense = ml.expense_id.filtered("amount_commit")