fix issue with multipe account in fix budget

This commit is contained in:
ronozoro 2024-10-06 23:54:38 -07:00
parent 659321b7c6
commit cf63e91165
No known key found for this signature in database
GPG Key ID: 7C2BDED35C62C0F3
26 changed files with 3 additions and 0 deletions

View File

@ -633,6 +633,9 @@ class PurchaseOrderCustom(models.Model):
raise ValidationError(
_("This product has no expense account") + ': {}'.format(rec.product_id.name))
budget_post = self.env['account.budget.post'].search([]).filtered(lambda x: account_id in x.account_ids)
if len(budget_post.ids) > 1:
raise ValidationError(
_("The Expense account %s is assigned to more than one budget position %s")%(account_id.name,[x.name for x in budget_post]))
if analytic_account:
budget_lines = self.env['crossovered.budget.lines'].search(
[('analytic_account_id', '=', analytic_account.id),