[minor] dont get warehouse in opening entry #7353

This commit is contained in:
Rushabh Mehta
2016-12-30 15:06:54 +05:30
parent a8326de4d0
commit 985cb8226d
3 changed files with 29 additions and 24 deletions

View File

@@ -434,7 +434,7 @@ class JournalEntry(AccountsController):
if not self.get('accounts'): if not self.get('accounts'):
msgprint(_("'Entries' cannot be empty"), raise_exception=True) msgprint(_("'Entries' cannot be empty"), raise_exception=True)
else: 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")) diff = flt(self.difference, self.precision("difference"))
# If any row without amount, set the diff on that row # If any row without amount, set the diff on that row
@@ -711,8 +711,14 @@ def get_payment_entry(ref_doc, args):
@frappe.whitelist() @frappe.whitelist()
def get_opening_accounts(company): def get_opening_accounts(company):
"""get all balance sheet accounts for opening entry""" """get all balance sheet accounts for opening entry"""
accounts = frappe.db.sql_list("""select name from tabAccount accounts = frappe.db.sql_list("""select
where is_group=0 and report_type='Balance Sheet' and company=%s""", company) 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] 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 from frappe.model.document import Document
class BuyingSettings(Document): class BuyingSettings(Document):
def validate(self): def validate(self):
for key in ["supplier_type", "supp_master_name", "maintain_same_rate", "buying_price_list"]: for key in ["supplier_type", "supp_master_name", "maintain_same_rate", "buying_price_list"]:
frappe.db.set_default(key, self.get(key, "")) 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 args.get("price_list"):
if not frappe.db.get_value("Price List", if not frappe.db.get_value("Price List",
{"name": args.price_list, args.transaction_type: 1, "enabled": 1}): {"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: else:
throw(_("Price List not selected")) throw(_("Price List not selected"))
@@ -468,7 +468,7 @@ def get_price_list_currency(price_list):
"enabled": 1}, ["name", "currency"], as_dict=True) "enabled": 1}, ["name", "currency"], as_dict=True)
if not result: 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 return result.currency