Merge branch '1310' of github.com:webnotes/erpnext

Conflicts:
	accounts/doctype/account/account.py
	controllers/accounts_controller.py
	patches/patch_list.py
	selling/doctype/sales_common/sales_common.py
	stock/doctype/purchase_receipt/purchase_receipt.py
This commit is contained in:
Anand Doshi
2013-11-15 19:12:09 +05:30
26 changed files with 590 additions and 143 deletions

View File

@@ -5,6 +5,7 @@ from __future__ import unicode_literals
import webnotes
from webnotes import _, msgprint
from webnotes.utils import flt, cint, today, cstr
from webnotes.model.code import get_obj
from setup.utils import get_company_currency
from accounts.utils import get_fiscal_year, validate_fiscal_year
from utilities.transaction_base import TransactionBase, validate_conversion_rate
@@ -423,6 +424,16 @@ class AccountsController(TransactionBase):
return self._abbr
def check_credit_limit(self, account):
total_outstanding = webnotes.conn.sql("""
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
from `tabGL Entry` where account = %s""", account)
total_outstanding = total_outstanding[0][0] if total_outstanding else 0
if total_outstanding:
get_obj('Account', account).check_credit_limit(total_outstanding)
@webnotes.whitelist()
def get_tax_rate(account_head):
return webnotes.conn.get_value("Account", account_head, "tax_rate")
return webnotes.conn.get_value("Account", account_head, "tax_rate")