mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
fix: multiple minor fixes
This commit is contained in:
@@ -69,6 +69,7 @@ class Budget(Document):
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
if not self.get(frappe.scrub(self.budget_against)):
|
if not self.get(frappe.scrub(self.budget_against)):
|
||||||
frappe.throw(_("{0} is mandatory").format(self.budget_against))
|
frappe.throw(_("{0} is mandatory").format(self.budget_against))
|
||||||
|
self.validate_budget_amount()
|
||||||
self.validate_fiscal_year()
|
self.validate_fiscal_year()
|
||||||
self.set_fiscal_year_dates()
|
self.set_fiscal_year_dates()
|
||||||
self.validate_duplicate()
|
self.validate_duplicate()
|
||||||
@@ -77,6 +78,10 @@ class Budget(Document):
|
|||||||
self.validate_applicable_for()
|
self.validate_applicable_for()
|
||||||
self.validate_existing_expenses()
|
self.validate_existing_expenses()
|
||||||
|
|
||||||
|
def validate_budget_amount(self):
|
||||||
|
if self.budget_amount <= 0:
|
||||||
|
frappe.throw(_("Budget Amount can not be {0}.").format(self.budget_amount))
|
||||||
|
|
||||||
def validate_fiscal_year(self):
|
def validate_fiscal_year(self):
|
||||||
if self.from_fiscal_year:
|
if self.from_fiscal_year:
|
||||||
self.validate_fiscal_year_company(self.from_fiscal_year, self.company)
|
self.validate_fiscal_year_company(self.from_fiscal_year, self.company)
|
||||||
@@ -370,6 +375,9 @@ def validate_expense_against_budget(params, expense_amount=0):
|
|||||||
if not params.account:
|
if not params.account:
|
||||||
params.account = params.get("expense_account")
|
params.account = params.get("expense_account")
|
||||||
|
|
||||||
|
if not params.get("expense_account") and params.get("account"):
|
||||||
|
params.expense_account = params.account
|
||||||
|
|
||||||
if not (params.get("account") and params.get("cost_center")) and params.item_code:
|
if not (params.get("account") and params.get("cost_center")) and params.item_code:
|
||||||
params.cost_center, params.account = get_item_details(params)
|
params.cost_center, params.account = get_item_details(params)
|
||||||
|
|
||||||
|
|||||||
@@ -619,7 +619,7 @@ def set_total_expense_zero(posting_date, budget_against_field=None, budget_again
|
|||||||
{
|
{
|
||||||
"account": "_Test Account Cost for Goods Sold - _TC",
|
"account": "_Test Account Cost for Goods Sold - _TC",
|
||||||
"cost_center": "_Test Cost Center - _TC",
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
"monthly_end_date": posting_date,
|
"month_end_date": posting_date,
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"from_fiscal_year": fiscal_year,
|
"from_fiscal_year": fiscal_year,
|
||||||
"to_fiscal_year": fiscal_year,
|
"to_fiscal_year": fiscal_year,
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ class BudgetValidation:
|
|||||||
frappe.bold(key[2]),
|
frappe.bold(key[2]),
|
||||||
frappe.bold(frappe.unscrub(key[0])),
|
frappe.bold(frappe.unscrub(key[0])),
|
||||||
frappe.bold(key[1]),
|
frappe.bold(key[1]),
|
||||||
frappe.bold(fmt_money(v_map.accumulated_montly_budget, currency=currency)),
|
frappe.bold(fmt_money(v_map.accumulated_monthly_budget, currency=currency)),
|
||||||
self.budget_applicable_for(v_map, current_amt),
|
self.budget_applicable_for(v_map, current_amt),
|
||||||
frappe.bold(fmt_money(monthly_diff, currency=currency)),
|
frappe.bold(fmt_money(monthly_diff, currency=currency)),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ def migrate_single_budget(budget_name):
|
|||||||
if not account_rows:
|
if not account_rows:
|
||||||
return
|
return
|
||||||
|
|
||||||
frappe.db.delete("Budget Account", {"parent": budget_doc.name})
|
frappe.db.delete("Budget Account", filters={"parent": budget_doc.name})
|
||||||
|
|
||||||
percentage_allocations = get_percentage_allocations(budget_doc)
|
percentage_allocations = get_percentage_allocations(budget_doc)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user