Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
8ba2f6396b
@ -340,7 +340,7 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
and batch_no like '%(txt)s'
|
and batch_no like '%(txt)s'
|
||||||
and exists(select * from `tabBatch`
|
and exists(select * from `tabBatch`
|
||||||
where name = sle.batch_no
|
where name = sle.batch_no
|
||||||
and expiry_date >= '%(posting_date)s'
|
and (ifnull(expiry_date, '')='' or expiry_date >= '%(posting_date)s')
|
||||||
and docstatus != 2)
|
and docstatus != 2)
|
||||||
%(mcond)s
|
%(mcond)s
|
||||||
group by batch_no having sum(actual_qty) > 0
|
group by batch_no having sum(actual_qty) > 0
|
||||||
@ -353,7 +353,7 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
return webnotes.conn.sql("""select name from tabBatch
|
return webnotes.conn.sql("""select name from tabBatch
|
||||||
where docstatus != 2
|
where docstatus != 2
|
||||||
and item = '%(item_code)s'
|
and item = '%(item_code)s'
|
||||||
and expiry_date >= '%(posting_date)s'
|
and (ifnull(expiry_date, '')='' or expiry_date >= '%(posting_date)s')
|
||||||
and name like '%(txt)s'
|
and name like '%(txt)s'
|
||||||
%(mcond)s
|
%(mcond)s
|
||||||
order by name desc
|
order by name desc
|
||||||
|
@ -152,7 +152,8 @@ class DocType(SellingController):
|
|||||||
def validate_warehouse_user(self):
|
def validate_warehouse_user(self):
|
||||||
from stock.utils import validate_warehouse_user
|
from stock.utils import validate_warehouse_user
|
||||||
|
|
||||||
warehouses = list(set([d.reserved_warehouse for d in self.doclist.get({"doctype": self.tname})]))
|
warehouses = list(set([d.reserved_warehouse for d in
|
||||||
|
self.doclist.get({"doctype": self.tname}) if d.reserved_warehouse]))
|
||||||
|
|
||||||
for w in warehouses:
|
for w in warehouses:
|
||||||
validate_warehouse_user(w)
|
validate_warehouse_user(w)
|
||||||
|
@ -406,7 +406,7 @@ def import_data(dt, submit=False):
|
|||||||
|
|
||||||
for doctype in dt:
|
for doctype in dt:
|
||||||
print "Importing", doctype.replace("_", " "), "..."
|
print "Importing", doctype.replace("_", " "), "..."
|
||||||
webnotes.form_dict = {}
|
webnotes.form_dict = webnotes._dict()
|
||||||
if submit:
|
if submit:
|
||||||
webnotes.form_dict["params"] = json.dumps({"_submit": 1})
|
webnotes.form_dict["params"] = json.dumps({"_submit": 1})
|
||||||
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", doctype+".csv")
|
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", doctype+".csv")
|
||||||
|
@ -9,6 +9,23 @@ def make_demo_app():
|
|||||||
utilities.demo.make_demo.make(reset=True)
|
utilities.demo.make_demo.make(reset=True)
|
||||||
|
|
||||||
def make_demo_user():
|
def make_demo_user():
|
||||||
|
roles = ["Accounts Manager", "Analytics", "Expense Approver", "Accounts User",
|
||||||
|
"Leave Approver", "Blogger", "Customer", "Sales Manager", "Employee", "Support Manager",
|
||||||
|
"HR Manager", "HR User", "Maintenance Manager", "Maintenance User", "Material Manager",
|
||||||
|
"Material Master Manager", "Material User", "Partner", "Manufacturing Manager",
|
||||||
|
"Manufacturing User", "Projects User", "Purchase Manager", "Purchase Master Manager",
|
||||||
|
"Purchase User", "Quality Manager", "Report Manager", "Sales Master Manager",
|
||||||
|
"Sales User", "Supplier", "Support Team"]
|
||||||
|
|
||||||
|
def add_roles(bean):
|
||||||
|
for role in roles:
|
||||||
|
p.doclist.append({
|
||||||
|
"doctype": "UserRole",
|
||||||
|
"parentfield": "user_roles",
|
||||||
|
"role": role
|
||||||
|
})
|
||||||
|
|
||||||
|
# make demo user
|
||||||
if webnotes.conn.exists("Profile", "demo@erpnext.com"):
|
if webnotes.conn.exists("Profile", "demo@erpnext.com"):
|
||||||
webnotes.delete_doc("Profile", "demo@erpnext.com")
|
webnotes.delete_doc("Profile", "demo@erpnext.com")
|
||||||
|
|
||||||
@ -21,25 +38,31 @@ def make_demo_user():
|
|||||||
p.doc.send_invite_email = 0
|
p.doc.send_invite_email = 0
|
||||||
p.doc.new_password = "demo"
|
p.doc.new_password = "demo"
|
||||||
p.insert()
|
p.insert()
|
||||||
|
add_roles(p)
|
||||||
|
p.save()
|
||||||
|
|
||||||
for role in ("Accounts Manager", "Analytics", "Expense Approver", "Accounts User",
|
# make system manager user
|
||||||
"Leave Approver", "Blogger", "Customer", "Sales Manager", "Employee", "Support Manager",
|
if webnotes.conn.exists("Profile", "admin@erpnext.com"):
|
||||||
"HR Manager", "HR User", "Maintenance Manager", "Maintenance User", "Material Manager",
|
webnotes.delete_doc("Profile", "admin@erpnext.com")
|
||||||
"Material Master Manager", "Material User", "Partner", "Manufacturing Manager",
|
|
||||||
"Manufacturing User", "Projects User", "Purchase Manager", "Purchase Master Manager",
|
|
||||||
"Purchase User", "Quality Manager", "Report Manager", "Sales Master Manager", "Sales User",
|
|
||||||
"Supplier", "Support Team"):
|
|
||||||
p.doclist.append({
|
|
||||||
"doctype": "UserRole",
|
|
||||||
"parentfield": "user_roles",
|
|
||||||
"role": role
|
|
||||||
})
|
|
||||||
|
|
||||||
|
p = webnotes.new_bean("Profile")
|
||||||
|
p.doc.email = "admin@erpnext.com"
|
||||||
|
p.doc.first_name = "Admin"
|
||||||
|
p.doc.last_name = "User"
|
||||||
|
p.doc.enabled = 1
|
||||||
|
p.doc.user_type = "System User"
|
||||||
|
p.doc.send_invite_email = 0
|
||||||
|
p.doc.new_password = "admin010123"
|
||||||
|
p.insert()
|
||||||
|
roles.append("System Manager")
|
||||||
|
add_roles(p)
|
||||||
p.save()
|
p.save()
|
||||||
|
|
||||||
# only read for newsletter
|
# only read for newsletter
|
||||||
webnotes.conn.sql("""update `tabDocPerm` set `write`=0, `create`=0, `cancel`=0
|
webnotes.conn.sql("""update `tabDocPerm` set `write`=0, `create`=0, `cancel`=0
|
||||||
where parent='Newsletter'""")
|
where parent='Newsletter'""")
|
||||||
|
webnotes.conn.sql("""update `tabDocPerm` set `write`=0, `create`=0, `cancel`=0
|
||||||
|
where parent='Profile' and role='All'""")
|
||||||
|
|
||||||
webnotes.conn.commit()
|
webnotes.conn.commit()
|
||||||
|
|
||||||
@ -66,6 +89,7 @@ def make_demo_login_page():
|
|||||||
p.insert()
|
p.insert()
|
||||||
|
|
||||||
webnotes.conn.set_value("Website Settings", None, "home_page", "demo-login")
|
webnotes.conn.set_value("Website Settings", None, "home_page", "demo-login")
|
||||||
|
webnotes.conn.set_value("Website Settings", None, "disable_signup", 1)
|
||||||
|
|
||||||
webnotes.conn.commit()
|
webnotes.conn.commit()
|
||||||
|
|
||||||
@ -78,6 +102,10 @@ def make_demo_on_login_script():
|
|||||||
s.doc.script = dfile.read()
|
s.doc.script = dfile.read()
|
||||||
s.insert()
|
s.insert()
|
||||||
|
|
||||||
|
cp = webnotes.bean("Control Panel")
|
||||||
|
cp.doc.custom_startup_code = """wn.ui.toolbar.show_banner('You are using ERPNext Demo. To start your own ERPNext Trial, <a href="https://erpnext.com/pricing-and-signup" target="_blank">click here</a>')"""
|
||||||
|
cp.save()
|
||||||
|
|
||||||
webnotes.conn.commit()
|
webnotes.conn.commit()
|
||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
|
@ -55,6 +55,8 @@ class TransactionBase(StatusUpdater):
|
|||||||
return self._party_type_and_name
|
return self._party_type_and_name
|
||||||
|
|
||||||
def get_customer_defaults(self):
|
def get_customer_defaults(self):
|
||||||
|
if not self.doc.customer: return {}
|
||||||
|
|
||||||
out = self.get_default_address_and_contact("customer")
|
out = self.get_default_address_and_contact("customer")
|
||||||
|
|
||||||
customer = webnotes.doc("Customer", self.doc.customer)
|
customer = webnotes.doc("Customer", self.doc.customer)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user