From feb792d1cf3f49452f505e5f1794c0089f70dd6c Mon Sep 17 00:00:00 2001 From: eco-odoo Date: Wed, 26 Sep 2018 15:15:04 +0200 Subject: [PATCH] [FIX] account_budget: allow saving multiple budget lines The constraint did not take into account the possibility of adding multiple budget lines at the same time. --- addons/account_budget/models/account_budget.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/account_budget/models/account_budget.py b/addons/account_budget/models/account_budget.py index 961c957c2d7..d5500c2d623 100644 --- a/addons/account_budget/models/account_budget.py +++ b/addons/account_budget/models/account_budget.py @@ -237,9 +237,10 @@ class CrossoveredBudgetLines(models.Model): @api.constrains('general_budget_id', 'analytic_account_id') def _must_have_analytical_or_budgetary_or_both(self): - if not self.analytic_account_id and not self.general_budget_id: - raise ValidationError( - _("You have to enter at least a budgetary position or analytic account on a budget line.")) + for record in self: + if not record.analytic_account_id and not record.general_budget_id: + raise ValidationError( + _("You have to enter at least a budgetary position or analytic account on a budget line.")) @api.multi def action_open_budget_entries(self):