Merge branch 'develop' of https://github.com/frappe/erpnext into v5.0

This commit is contained in:
Nabin Hait 2015-02-26 12:32:04 +05:30
commit 851c745fdf
3 changed files with 10 additions and 2 deletions

View File

@ -55,6 +55,7 @@ class SalesInvoice(SellingController):
if cint(self.update_stock):
self.validate_item_code()
self.validate_warehouse()
self.update_current_stock()
self.validate_delivery_note()
@ -335,6 +336,11 @@ class SalesInvoice(SellingController):
if not d.item_code:
msgprint(_("Item Code required at Row No {0}").format(d.idx), raise_exception=True)
def validate_warehouse(self):
for d in self.get('entries'):
if not d.warehouse:
frappe.throw(_("Warehouse required at Row No {0}").format(d.idx))
def validate_delivery_note(self):
for d in self.get("items"):
if d.delivery_note:

View File

@ -161,7 +161,8 @@ def add_total_row(out, balance_must_be, period_list):
def get_accounts(company, root_type):
# root lft, rgt
root_account = frappe.db.sql("""select lft, rgt from `tabAccount`
where company=%s and root_type=%s order by lft limit 1""",
where company=%s and root_type=%s and ifnull(parent_account, '') = ''
order by lft limit 1""",
(company, root_type), as_dict=True)
if not root_account:

View File

@ -178,7 +178,8 @@ def get_basic_details(args, item):
# if default specified in item is for another company, fetch from company
for d in [["Account", "income_account", "default_income_account"], ["Account", "expense_account", "default_expense_account"],
["Cost Center", "cost_center", "cost_center"], ["Warehouse", "warehouse", ""]]:
if not out[d[1]] or args.company != frappe.db.get_value(d[0], out.get(d[1]), "company"):
company = frappe.db.get_value(d[0], out.get(d[1]), "company")
if not out[d[1]] or (company and args.company != company):
out[d[1]] = frappe.db.get_value("Company", args.company, d[2]) if d[2] else None
for fieldname in ("item_name", "item_group", "barcode", "brand", "stock_uom"):