Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
211b04a011
@ -43,14 +43,15 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doc.enquiry_from == 'Lead' && doc.lead) {
|
|
||||||
cur_frm.cscript.lead(doc,cdt,cdn);
|
|
||||||
}
|
|
||||||
|
|
||||||
// setup fetch
|
// setup fetch
|
||||||
cur_frm.cscript.set_fetch();
|
cur_frm.cscript.set_fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||||
|
if(doc.enquiry_from == 'Lead' && doc.lead) {
|
||||||
|
cur_frm.cscript.lead(doc,cdt,cdn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// fetch
|
// fetch
|
||||||
// ===============================================================
|
// ===============================================================
|
||||||
|
@ -22,11 +22,6 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
|
if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
|
||||||
if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});
|
if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});
|
||||||
|
|
||||||
// load default charges
|
|
||||||
if(doc.__islocal && !getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length) cur_frm.cscript.load_taxes(doc, cdt, cdn);
|
|
||||||
|
|
||||||
if(doc.__islocal==1){ cur_frm.cscript.price_list_name(doc, cdt, cdn);}
|
|
||||||
|
|
||||||
if(doc.quotation_to) {
|
if(doc.quotation_to) {
|
||||||
if(doc.quotation_to == 'Customer') {
|
if(doc.quotation_to == 'Customer') {
|
||||||
hide_field(['lead', 'lead_name']);
|
hide_field(['lead', 'lead_name']);
|
||||||
@ -37,6 +32,12 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||||
|
// load default charges
|
||||||
|
if(doc.__islocal && !getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length)
|
||||||
|
cur_frm.cscript.load_taxes(doc, cdt, cdn);
|
||||||
|
}
|
||||||
|
|
||||||
// hide - unhide fields based on lead or customer..
|
// hide - unhide fields based on lead or customer..
|
||||||
// =======================================================================================================================
|
// =======================================================================================================================
|
||||||
cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
|
cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
|
||||||
|
@ -14,10 +14,6 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
||||||
if (!doc.status) doc.status = 'Draft';
|
if (!doc.status) doc.status = 'Draft';
|
||||||
|
|
||||||
if(doc.__islocal){
|
|
||||||
cur_frm.cscript.get_default_schedule_date(doc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(doc.__islocal){
|
if(doc.__islocal){
|
||||||
hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
|
hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
|
||||||
}
|
}
|
||||||
@ -26,6 +22,12 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||||
|
if(doc.__islocal){
|
||||||
|
cur_frm.cscript.get_default_schedule_date(doc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//========================== Refresh ===============================================================
|
//========================== Refresh ===============================================================
|
||||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||||
|
|
||||||
|
@ -235,3 +235,10 @@ class DocType:
|
|||||||
sle_obj.validate()
|
sle_obj.validate()
|
||||||
sle.save(new = 1)
|
sle.save(new = 1)
|
||||||
return sle.name
|
return sle.name
|
||||||
|
|
||||||
|
def repost(self):
|
||||||
|
"""
|
||||||
|
Repost everything!
|
||||||
|
"""
|
||||||
|
for wh in sql("select name from tabWarehouse"):
|
||||||
|
get_obj('Warehouse', wh[0]).repost_stock()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# REMEMBER to update this
|
# REMEMBER to update this
|
||||||
# ========================
|
# ========================
|
||||||
last_patch = 293
|
last_patch = 294
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
|
|
||||||
@ -1167,3 +1167,10 @@ def execute(patch_no):
|
|||||||
elif patch_no == 293:
|
elif patch_no == 293:
|
||||||
sql("delete from tabDocField where parent='Account' and fieldname='address'")
|
sql("delete from tabDocField where parent='Account' and fieldname='address'")
|
||||||
reload_doc('accounts', 'doctype', 'account')
|
reload_doc('accounts', 'doctype', 'account')
|
||||||
|
elif patch_no == 294:
|
||||||
|
# new account profile fix
|
||||||
|
ul = sql("select name from tabProfile where ifnull(name,'') not in ('Administrator', 'Guest', '')")
|
||||||
|
# if one user and one user has no roles
|
||||||
|
if len(ul)==1 and not sql("select parent from tabUserRole where role='System Manager' and parent=%s", ul[0][0]):
|
||||||
|
get_obj('Setup Control').add_roles(Document('Profile', ul[0][0]))
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ from webnotes.model.doclist import getlist
|
|||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import session, form, is_testing, msgprint, errprint
|
from webnotes import session, form, is_testing, msgprint, errprint
|
||||||
|
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
convert_to_lists = webnotes.conn.convert_to_lists
|
convert_to_lists = webnotes.conn.convert_to_lists
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ class DocType:
|
|||||||
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
from webnotes.utils import flt
|
||||||
for d in getlist(self.doclist, 'target_details'):
|
for d in getlist(self.doclist, 'target_details'):
|
||||||
if not flt(d.target_qty) and not flt(d.target_amount):
|
if not flt(d.target_qty) and not flt(d.target_amount):
|
||||||
msgprint("Either target qty or target amount is mandatory.")
|
msgprint("Either target qty or target amount is mandatory.")
|
||||||
|
@ -142,23 +142,27 @@ class DocType:
|
|||||||
# Create Profile
|
# Create Profile
|
||||||
# --------------
|
# --------------
|
||||||
def create_profile(self, user_email, user_fname, user_lname):
|
def create_profile(self, user_email, user_fname, user_lname):
|
||||||
roles_list = ['System Manager','Sales Manager','Sales User','Purchase Manager','Purchase User','Material Manager','Material User','Accounts Manager','Accounts User','HR Manager','HR User','Production Manager','Production User','Sales Master Manager','Purchase Master Manager','Material Master Manager','Quality Manager','Maintenance User','Maintenance Manager']
|
|
||||||
pr = Document('Profile')
|
pr = Document('Profile')
|
||||||
pr.first_name = user_fname
|
pr.first_name = user_fname
|
||||||
pr.last_name = user_lname
|
pr.last_name = user_lname
|
||||||
pr.email = user_email
|
pr.email = user_email
|
||||||
pr.enabled = 1
|
pr.enabled = 1
|
||||||
pr.save(1)
|
pr.save(1)
|
||||||
|
self.add_roles(pr)
|
||||||
|
|
||||||
|
def add_roles(self, pr):
|
||||||
|
roles_list = ['System Manager','Sales Manager','Sales User','Purchase Manager','Purchase User','Material Manager','Material User','Accounts Manager','Accounts User','HR Manager','HR User','Production Manager','Production User','Sales Master Manager','Purchase Master Manager','Material Master Manager','Quality Manager','Maintenance User','Maintenance Manager']
|
||||||
for r in roles_list:
|
for r in roles_list:
|
||||||
d = addchild(pr, 'userroles', 'UserRole', 1)
|
d = addchild(pr, 'userroles', 'UserRole', 1)
|
||||||
d.role = r
|
d.role = r
|
||||||
d.save()
|
d.save(1)
|
||||||
|
|
||||||
# Add roles to Administrator profile
|
# Add roles to Administrator profile
|
||||||
pr_obj = get_obj('Profile','Administrator')
|
pr_obj = get_obj('Profile','Administrator')
|
||||||
for r in roles_list:
|
for r in roles_list:
|
||||||
d = addchild(pr_obj.doc,'userroles', 'UserRole', 1)
|
d = addchild(pr_obj.doc,'userroles', 'UserRole', 1)
|
||||||
d.role = r
|
d.role = r
|
||||||
d.save()
|
d.save(1)
|
||||||
|
|
||||||
# Update WN ERP Client Control
|
# Update WN ERP Client Control
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
@ -9,6 +9,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date())
|
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date())
|
||||||
if (!doc.status) doc.status = 'Draft';
|
if (!doc.status) doc.status = 'Draft';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||||
// second call
|
// second call
|
||||||
if(doc.__islocal){
|
if(doc.__islocal){
|
||||||
cur_frm.cscript.get_item_defaults(doc);
|
cur_frm.cscript.get_item_defaults(doc);
|
||||||
|
@ -16,15 +16,17 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
||||||
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
|
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
|
||||||
|
|
||||||
if(doc.__islocal){
|
|
||||||
cur_frm.cscript.get_default_schedule_date(doc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(doc.__islocal){
|
if(doc.__islocal){
|
||||||
hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
|
hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||||
|
if(doc.__islocal){
|
||||||
|
cur_frm.cscript.get_default_schedule_date(doc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ================================== Refresh ==========================================
|
// ================================== Refresh ==========================================
|
||||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user