Merge pull request #7442 from nabinhait/hotfix

Fix for Budget against Project
This commit is contained in:
Nabin Hait 2017-01-11 10:30:44 +05:30 committed by GitHub
commit ffa5ffe607
2 changed files with 32 additions and 29 deletions

View File

@ -63,7 +63,7 @@ def validate_expense_against_budget(args):
and frappe.db.get_value("Account", {"name": args.account, "root_type": "Expense"}):
if args.project:
condition = "and exists(select name from `tabProject` where name=b.project)"
condition = "and b.project='%s'" % frappe.db.escape(args.project)
args.budget_against_field = "Project"
elif args.cost_center:
@ -89,11 +89,12 @@ def validate_expense_against_budget(args):
budget_against_field=frappe.scrub(args.get("budget_against_field"))),
(args.fiscal_year, args.account), as_dict=True)
if budget_records:
validate_budget_records(args, budget_records)
def validate_budget_records(args, budget_records):
for budget in budget_records:
if budget.budget_amount:
if flt(budget.budget_amount):
yearly_action = budget.action_if_annual_budget_exceeded
monthly_action = budget.action_if_accumulated_monthly_budget_exceeded

View File

@ -651,6 +651,7 @@ class SalesInvoice(SellingController):
def make_pos_gl_entries(self, gl_entries):
if cint(self.is_pos):
for payment_mode in self.payments:
if payment_mode.amount:
# POS, make payment entries
gl_entries.append(
self.get_gl_dict({
@ -674,7 +675,8 @@ class SalesInvoice(SellingController):
"against": self.customer,
"debit": payment_mode.base_amount,
"debit_in_account_currency": payment_mode.base_amount \
if payment_mode_account_currency==self.company_currency else payment_mode.amount
if payment_mode_account_currency==self.company_currency \
else payment_mode.amount
}, payment_mode_account_currency)
)