[fix] Check if company exists in re-order item. Fixes #3365.

This commit is contained in:
Anand Doshi 2015-05-28 01:09:21 -04:00
parent 81bded1afe
commit 8860b9d94d

View File

@ -7,7 +7,7 @@ from frappe.utils import flt, cstr, nowdate, add_days, cint
def reorder_item():
""" Reorder item if stock reaches reorder level"""
# if initial setup not completed, return
if not frappe.db.sql("select name from `tabFiscal Year` limit 1"):
if not (frappe.db.a_row_exists("Company") and frappe.db.a_row_exists("Fiscal Year")):
return
if cint(frappe.db.get_value('Stock Settings', None, 'auto_indent')):
@ -159,7 +159,7 @@ def send_email_notification(mr_list):
msg += "<tr><td>" + item.item_code + "</td><td>" + item.warehouse + "</td><td>" + \
cstr(item.qty) + "</td><td>" + cstr(item.uom) + "</td></tr>"
msg += "</table>"
frappe.sendmail(recipients=email_list,
frappe.sendmail(recipients=email_list,
subject='Auto Material Request Generation Notification', message = msg)
def notify_errors(exceptions_list):