add correct info

This commit is contained in:
ronozoro 2024-10-06 23:55:35 -07:00
parent 217e7dc3d1
commit bb73384d10
No known key found for this signature in database
GPG Key ID: 7C2BDED35C62C0F3
3 changed files with 11 additions and 0 deletions

View File

@ -190,6 +190,9 @@ class AccountMove(models.Model):
if not line.analytic_account_id:
raise ValidationError(_('Please Choose Analytic account for This Bill'))
budget_post = self.env['account.budget.post'].search([]).filtered(lambda x: line.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")%(line.account_id.name,[x.name for x in budget_post]))
budget_lines = self.env['crossovered.budget.lines'].search(
[('analytic_account_id', '=', line.analytic_account_id.id),
('general_budget_id', 'in', budget_post),

View File

@ -142,6 +142,10 @@ class AccountMove(models.Model):
def action_budget(self):
budget_post = self.env['account.budget.post'].search([]).filtered(lambda x: self.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") % (
self.account_id.name, [x.name for x in budget_post]))
budget_lines = self.env['crossovered.budget.lines'].search(
[('analytic_account_id', '=', self.analytic_account_id.id),
('general_budget_id', 'in', budget_post),

View File

@ -65,6 +65,10 @@ class PurchaseRequest(models.Model):
_("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]))
budget_lines = self.env['crossovered.budget.lines'].search(
[('analytic_account_id', '=', analytic_account.id),
('general_budget_id', 'in', budget_post.ids),