Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple Budgets for unique Cost Center + Account+ Fiscal Year #12681

Conversation

ashish-greycube
Copy link
Contributor

@ashish-greycube ashish-greycube commented Jan 28, 2018

In context to #12663
Made changes to budget.py such that validate_duplicate function checks for uniqueness based on (cost center+fiscal year+company+account)
budgetpr

@rohitwaghchaure rohitwaghchaure self-assigned this Jan 29, 2018
for present_account in self.get('accounts'):
if present_account.account == budget_account_details.account:
frappe.throw(_("Another Budget record '{0}' already exists against {1} '{2}' for account '{3}' & fiscal year {4}")
.format(existing_budget.name, self.budget_against, budget_against, present_account.account,self.fiscal_year), DuplicateBudgetError)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of multiple for loops, you can directly check using join query between doctype 'Budget' and 'Budget Account' and if records found then throw an exception
like frappe.db.sql(""" check record found against the Cost Center/Project + Account+ Fiscal Year """)

@rohitwaghchaure
Copy link
Collaborator

@ashish-greycube
Closing PR, Kindly make suggested changes and Reopen the PR
After making changes in the local repo, first reopen this closed PR and then push local changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants