Merge pull request #7362 from rmehta/minor-fixes

[minor] dont get warehouse in opening entry #7353
This commit is contained in:
Nabin Hait 2017-01-04 15:42:23 +05:30 committed by GitHub
commit 96562e3eb7
3 changed files with 29 additions and 24 deletions

View File

@ -436,7 +436,7 @@ class JournalEntry(AccountsController):
if not self.get('accounts'):
msgprint(_("'Entries' cannot be empty"), raise_exception=True)
else:
flag, self.total_debit, self.total_credit = 0, 0, 0
self.total_debit, self.total_credit = 0, 0
diff = flt(self.difference, self.precision("difference"))
# If any row without amount, set the diff on that row
@ -715,8 +715,14 @@ def get_payment_entry(ref_doc, args):
@frappe.whitelist()
def get_opening_accounts(company):
"""get all balance sheet accounts for opening entry"""
accounts = frappe.db.sql_list("""select name from tabAccount
where is_group=0 and report_type='Balance Sheet' and company=%s""", company)
accounts = frappe.db.sql_list("""select
name from tabAccount
where
is_group=0 and
report_type='Balance Sheet' and
ifnull(warehouse, '') = '' and
company=%s
order by name asc""", company)
return [{"account": a, "balance": get_balance_on(a)} for a in accounts]

View File

@ -9,7 +9,6 @@ import frappe
from frappe.model.document import Document
class BuyingSettings(Document):
def validate(self):
for key in ["supplier_type", "supp_master_name", "maintain_same_rate", "buying_price_list"]:
frappe.db.set_default(key, self.get(key, ""))

View File

@ -269,7 +269,7 @@ def validate_price_list(args):
if args.get("price_list"):
if not frappe.db.get_value("Price List",
{"name": args.price_list, args.transaction_type: 1, "enabled": 1}):
throw(_("Price List {0} is disabled").format(args.price_list))
throw(_("Price List {0} is disabled or does not exist").format(args.price_list))
else:
throw(_("Price List not selected"))
@ -468,7 +468,7 @@ def get_price_list_currency(price_list):
"enabled": 1}, ["name", "currency"], as_dict=True)
if not result:
throw(_("Price List {0} is disabled").format(price_list))
throw(_("Price List {0} is disabled or does not exist").format(price_list))
return result.currency