fixed conflict in patches

This commit is contained in:
Nabin Hait 2011-09-13 14:33:22 +05:30
commit 939468f11e
20 changed files with 759 additions and 230 deletions

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:36',
'docstatus': 0,
'modified': '2011-08-08 16:56:40',
'modified': '2011-08-31 16:53:11',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@ -31,7 +31,7 @@
# These values are common for all DocType Mapper
{
'doctype': 'DocType Mapper',
'doctype': u'DocType Mapper',
'from_doctype': 'Sales Order',
'module': 'Accounts',
'name': '__common__',
@ -41,7 +41,7 @@
# DocType Mapper, Sales Order-Receivable Voucher
{
'doctype': 'DocType Mapper',
'doctype': u'DocType Mapper',
'name': 'Sales Order-Receivable Voucher'
},
@ -128,7 +128,7 @@
'match_id': 1,
'to_field': 'entries',
'to_table': 'RV Detail',
'validation_logic': 'amount > ifnull(billed_amt, 0) and docstatus = 1'
'validation_logic': 'docstatus = 1'
},
# Table Mapper Detail

View File

@ -18,10 +18,10 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()});
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
//for previously created sales invoice, set required field related to pos
if(doc.is_pos ==1) cur_frm.cscript.is_pos(doc, dt, dn);
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
}
@ -37,10 +37,10 @@ cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
}
);
}
if(!doc.customer && doc.__islocal) {
// new -- load default taxes
cur_frm.cscript.load_taxes(doc, cdt, cdn);
cur_frm.cscript.load_taxes(doc, cdt, cdn);
}
}
@ -61,19 +61,19 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
// Show / Hide button
cur_frm.clear_custom_buttons();
if(doc.docstatus==1) {
if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript['View Ledger Entry']);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
unhide_field('Repair Outstanding Amt');
if(doc.is_pos==1 && doc.update_stock!=1)
cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
if(doc.outstanding_amount!=0)
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript['Make Bank Voucher']);
}
else
else
hide_field('Repair Outstanding Amt');
cur_frm.cscript.is_opening(doc, dt, dn);
cur_frm.cscript.hide_fields(doc, cdt, cdn);
@ -117,13 +117,13 @@ cur_frm.cscript.customer = function(doc,dt,dn) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
get_server_fields('get_debit_to','','',doc, dt, dn, 0);
cur_frm.refresh();
}
}
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
}
@ -152,15 +152,15 @@ cur_frm.cscript.debit_to = function(doc,dt,dn) {
var callback2 = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
cur_frm.refresh();
}
}
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
var doc = locals[cur_frm.doctype][cur_frm.docname];
if(doc.customer) $c_obj(make_doclist(dt,dn), 'get_default_customer_address', '', callback2);
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
cur_frm.refresh();
}
if(doc.debit_to && doc.posting_date){
get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,callback);
}
@ -187,13 +187,13 @@ cur_frm.cscript.project_name = function(doc,cdt,cdn){
//Set debit and credit to zero on adding new row
//----------------------------------------------
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
cl = getchildren('RV Detail', doc.name, cur_frm.cscript.fname, doc.doctype);
acc = '';
cc = '';
for(var i = 0; i<cl.length; i++) {
if (cl[i].idx == 1){
acc = cl[i].income_account;
cc = cl[i].cost_center;
@ -221,7 +221,7 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) {
// Get Items based on SO or DN Selected
cur_frm.cscript['Get Items'] = function(doc, dt, dn) {
var callback = function(r,rt) {
var callback = function(r,rt) {
unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
cur_frm.refresh();
}
@ -335,10 +335,10 @@ cur_frm.fields_dict.sales_order_main.get_query = function(doc) {
// Delivery Note
// --------------
cur_frm.fields_dict.delivery_note_main.get_query = function(doc) {
if (doc.customer)
return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` WHERE `tabDelivery Note`.company = "' + doc.company + '" and `tabDelivery Note`.`docstatus` = 1 and ifnull(`tabDelivery Note`.per_billed,0) < 100 and `tabDelivery Note`.`customer` = "' + doc.customer + '" and `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';
if (doc.customer)
return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` WHERE `tabDelivery Note`.company = "' + doc.company + '" and `tabDelivery Note`.`docstatus` = 1 and ifnull(`tabDelivery Note`.per_billed,0) < 100 and `tabDelivery Note`.`customer` = "' + doc.customer + '" and `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';
else
return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` WHERE `tabDelivery Note`.company = "' + doc.company + '" and `tabDelivery Note`.`docstatus` = 1 and ifnull(`tabDelivery Note`.per_billed,0) < 100 and `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';
return 'SELECT DISTINCT `tabDelivery Note`.`name` FROM `tabDelivery Note` WHERE `tabDelivery Note`.company = "' + doc.company + '" and `tabDelivery Note`.`docstatus` = 1 and ifnull(`tabDelivery Note`.per_billed,0) < 100 and `tabDelivery Note`.%(key)s LIKE "%s" ORDER BY `tabDelivery Note`.`name` DESC LIMIT 50';
}
@ -393,18 +393,18 @@ cur_frm.cscript.make_jv = function(doc, dt, dn) {
jv.company = doc.company;
jv.remark = repl('Payment received against invoice %(vn)s for %(rem)s', {vn:doc.name, rem:doc.remarks});
jv.fiscal_year = doc.fiscal_year;
// debit to creditor
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
d1.account = doc.debit_to;
d1.credit = doc.outstanding_amount;
d1.against_invoice = doc.name;
// credit to bank
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
d1.debit = doc.outstanding_amount;
loaddoc('Journal Voucher', jv.name);
}

View File

@ -580,6 +580,7 @@ class DocType(TransactionBase):
# Get Warehouse
def get_warehouse(self):
w = sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company))
w = w and w[0][0] or ''
if not w:
ps = sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
if not ps:

View File

@ -11,8 +11,8 @@ else:
from_date = filter_values['posting_date']
to_date = filter_values['posting_date1']
ysd, from_date_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",from_date)[0]
from_date_year = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",from_date)[0][0]
#to_date_year = sql("select name from `tabFiscal Year` where %s between year_start_date and date_sub(date_add(year_start_date,interval 1 year), interval 1 day)",to_date)[0][0]
# define columns
#---------------
@ -49,13 +49,25 @@ total_diff = total_debit - total_credit
# opening
account = filter_values.get('account')
if account:
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
closing_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, to_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
if acc_det[0][0] == 'Credit':
closing_bal = -1*closing_bal
if not account:
msgprint('Select an account to proceed',raise_exception=0,small=1)
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
opening_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, from_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
closing_bal = get_obj('GL Control').get_as_on_balance(account, from_date_year, to_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
if acc_det[0][0] == 'Credit':
closing_bal = -1*closing_bal
opening_bal = -1*opening_bal
out = []
t_row = ['' for i in range(len(colnames))]
t_row[1] = 'Opening as on '+formatdate(from_date)
t_row[col_idx['Debit']-1] = opening_bal
out.append(t_row)
count = 0
for r in res:
count +=1
@ -71,24 +83,24 @@ if total_debit != 0 or total_credit != 0:
# Total debit/credit
t_row = ['' for i in range(len(colnames))]
t_row[1] = 'Total'
t_row[col_idx['Debit']-1] = total_debit
t_row[col_idx['Credit']-1] = total_credit
t_row[col_idx['Debit']-1] = total_debit
t_row[col_idx['Credit']-1] = total_credit
out.append(t_row)
# diffrence (dr-cr)
t_row = ['' for i in range(len(colnames))]
t_row[1] = 'Total(Dr-Cr)'
t_row[col_idx['Debit']-1] = total_diff
t_row[col_idx['Debit']-1] = total_diff
out.append(t_row)
# closing
if account:
t_row = ['' for i in range(len(colnames))]
t_row[1] = 'Closing Balance on ' + to_date
t_row[1] = 'Closing Balance on ' + formatdate(to_date)
t_row[col_idx['Debit']-1] = flt(closing_bal)
out.append(t_row)
# Print Format
myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
</tr>
@ -99,5 +111,5 @@ myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
""" % {'acc':account,
'fdt':from_date,
'tdt':to_date}
page_template = myheader+"<div>%(table)s</div>"

View File

@ -53,6 +53,15 @@ class DocType:
pr.role = r
pr.parentfield = 'userroles'
pr.save(1)
# Update Membership Type at Gateway
if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
if 'System Manager' in role_list : membership_type = 'Administrator'
else : membership_type = 'Member'
import server_tools.gateway_utils
server_tools.gateway_utils.update_membership_type(cstr(arg['usr']), membership_type)
sql("delete from __SessionCache where user=%s", cstr(arg['usr']))
# Save profile

View File

@ -322,7 +322,7 @@ MemberProfile = function(parent, uid, member_item) {
// show securty settings
this.set_security = function() {
var d = new wn.widgets.Dialog({
var sd = new wn.widgets.Dialog({
title: 'Set User Security',
width: 500,
fields: [
@ -362,30 +362,72 @@ MemberProfile = function(parent, uid, member_item) {
}
]
});
d.onshow = function() {
d.set_values({
me.sec_dialog = sd
sd.onshow = function() {
me.sec_dialog.set_values({
restrict_ip: me.profile.restrict_ip || '',
login_before: me.profile.login_before || '',
login_after: me.profile.login_after || '',
new_password: ''
})
}
d.fields_dict.update.input.onclick = function() {
});
};
sd.fields_dict.update.input.onclick = function() {
var btn = this;
this.set_working();
var args = d.get_values();
var args = me.sec_dialog.get_values();
args.user = me.profile.name;
$c_page('home', 'my_company', 'update_security', JSON.stringify(args), function(r,rt) {
if(r.exc) {
msgprint(r.exc);
if (args.new_password) {
var pass_d = new wn.widgets.Dialog({
title: 'Your Password',
width: 300,
fields: [
{
label: 'Please Enter Your Password',
description: "Your password is required to update the concerned user's password",
fieldtype: 'Password',
fieldname: 'sys_admin_pwd',
reqd: 1
},
{
label: 'Continue',
fieldtype: 'Button',
fieldname: 'continue'
}
]
});
pass_d.fields_dict.continue.input.onclick = function() {
btn.pwd_dialog.hide();
args.sys_admin_pwd = btn.pwd_dialog.get_values().sys_admin_pwd;
btn.set_working();
me.update_security(args);
btn.done_working();
return;
}
$.extend(me.profile, d.get_values());
d.hide();
});
}
d.show();
pass_d.show();
btn.pwd_dialog = pass_d;
btn.done_working();
} else {
btn.done_working();
me.update_security(args);
}
};
sd.show();
}
this.update_security = function(args) {
$c_page('home', 'my_company', 'update_security', JSON.stringify(args), function(r,rt) {
if(r.exc) {
msgprint(r.exc);
return;
}
me.sec_dialog.hide();
$.extend(me.profile, me.sec_dialog.get_values());
});
}
// delete user

View File

@ -140,8 +140,7 @@ def update_security(args=''):
if 'new_password' in args:
if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
import server_tools.gateway_utils
webnotes.msgprint(server_tools.gateway_utils.change_password('', args['new_password'])['message'])
webnotes.msgprint(server_tools.gateway_utils.change_password('', args['new_password'], args['user'], args['sys_admin_pwd'])['message'])
else:
webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s", (args['new_password'], args['user']))
webnotes.msgprint('Settings Updated')
else: webnotes.msgprint('Settings Updated')

View File

@ -182,24 +182,24 @@ class DocType(TransactionBase):
earn_table = ''
ded_table = ''
if earn_ret:
earn_table += "<table cellspacing= '5' cellpadding='5' >"
earn_table += "<table cellspacing=5px cellpadding=5px width='100%%'>"
for e in earn_ret:
if not e[1]:
earn_table +='<tr><td>%s</td><td>0.00</td></tr>'%(cstr(e[0]))
earn_table +='<tr><td>%s</td><td align="right">0.00</td></tr>'%(cstr(e[0]))
else:
earn_table +='<tr><td>%s</td><td>%s</td></tr>'%(cstr(e[0]),cstr(e[1]))
earn_table +='<tr><td>%s</td><td align="right">%s</td></tr>'%(cstr(e[0]),cstr(e[1]))
earn_table += '</table>'
if ded_ret:
ded_table += "<table cellspacing= '5' cellpadding='5' >"
ded_table += "<table cellspacing=5px cellpadding=5px width='100%%'>"
for d in ded_ret:
if not d[1]:
ded_table +='<tr><td>%s</td><td>0.00</td></tr>'%(cstr(d[0]))
ded_table +='<tr><td">%s</td><td align="right">0.00</td></tr>'%(cstr(d[0]))
else:
ded_table +='<tr><td>%s</td><td>%s</td></tr>'%(cstr(d[0]),cstr(d[1]))
ded_table +='<tr><td>%s</td><td align="right">%s</td></tr>'%(cstr(d[0]),cstr(d[1]))
ded_table += '</table>'
letter_head = sql("select value from `tabSingles` where field = 'letter_head' and doctype = 'Control Panel'")
@ -210,57 +210,58 @@ class DocType(TransactionBase):
msg = '''<div> %s <br>
<table cellspacing= "5" cellpadding="5" width = "100%%">
<tr>
<td colspan = 4 width = "100%%"><h4>Salary Slip</h4></td>
<td width = "100%%" colspan = "2"><h4>Salary Slip</h4></td>
</tr>
<tr>
<td colspan = 2 width = "50%%"><b>Employee Code : %s</b></td>
<td colspan = 2 width = "50%%"><b>Employee Name : %s</b></td>
<td width = "50%%"><b>Employee Code : %s</b></td>
<td width = "50%%"><b>Employee Name : %s</b></td>
</tr>
<tr>
<td colspan = 2 width = "50%%">Month : %s</td>
<td colspan = 2 width = "50%%">Fiscal Year : %s</td>
</tr>
</table>
<table cellspacing= "5" cellpadding="5" >
<tr>
<td>Department : %s</td>
<td>Branch : %s</td>
<td colspan = 2>Designation : %s</td>
<td width = "50%%">Month : %s</td>
<td width = "50%%">Fiscal Year : %s</td>
</tr>
<tr>
<td>Grade : %s</td>
<td>Bank Account No. : %s</td>
<td colspan = 2>Bank Name : %s</td>
<td width = "50%%">Department : %s</td>
<td width = "50%%">Branch : %s</td>
</tr>
<tr>
<td width = "50%%">Designation : %s</td>
<td width = "50%%">Grade : %s</td>
</tr>
<tr>
<td width = "50%%">Bank Account No. : %s</td>
<td width = "50%%">Bank Name : %s</td>
</tr>
<tr>
<td colspan = 2>Arrear Amount : <b>%s</b></td>
<td colspan = 2>Payment days : %s</td>
<td width = "50%%">Arrear Amount : <b>%s</b></td>
<td width = "50%%">Payment days : %s</td>
</tr>
</table>
<table border="1px solid #CCC" width="100%%" cellpadding="0" cellspacing= "0" >
<table border="1px solid #CCC" width="100%%" cellpadding="0px" cellspacing="0px">
<tr>
<td colspan = 2 width = "50%%"><b>Earning</b></td>
<td colspan = 2 width = "50%%"><b>Deduction</b></td>
<td colspan = 2 width = "50%%" bgcolor="#CCC" align="center"><b>Earnings</b></td>
<td colspan = 2 width = "50%%" bgcolor="#CCC" align="center"><b>Deductions</b></td>
</tr>
<tr>
<td colspan = 2 width = "50%%">%s</td>
<td colspan = 2 width = "50%%">%s</td>
<td colspan = 2 width = "50%%" valign= "top">%s</td>
<td colspan = 2 width = "50%%" valign= "top">%s</td>
</tr>
</table>
<table cellspacing= "5" cellpadding="5">
<table cellspacing= "5" cellpadding="5" width = '100%%'>
<tr>
<td colspan = 2><b>Gross Pay :</b> %s</td>
<td colspan = 2><b>Total Deduction :</b> %s</td>
<td width = '25%%'><b>Gross Pay :</b> </td><td width = '25%%' align='right'>%s</td>
<td width = '25%%'><b>Total Deduction :</b></td><td width = '25%%' align='right'> %s</td>
</tr>
<tr>
<td><b>Net Pay : %s</b></td>
<tdwidth='25%%'><b>Net Pay : </b></td><td width = '25%%' align='right'><b>%s</b></td>
<td colspan = '2' width = '50%%'></td>
</tr>
<tr>
<td><b>Net Pay(in words) : %s</b></td>
<td width='25%%'><b>Net Pay(in words) : </td><td colspan = '3' width = '50%%'>%s</b></td>
</tr>
</table></div>'''%(cstr(letter_head[0][0]),cstr(self.doc.employee), cstr(self.doc.employee_name), cstr(self.doc.month), cstr(self.doc.fiscal_year), cstr(self.doc.department), cstr(self.doc.branch), cstr(self.doc.designation), cstr(self.doc.grade), cstr(self.doc.bank_account_no), cstr(self.doc.bank_name), cstr(self.doc.arrear_amount), cstr(self.doc.payment_days), earn_table, ded_table, cstr(self.doc.gross_pay), cstr(self.doc.total_deduction), cstr(self.doc.net_pay), cstr(self.doc.total_in_words))
</table></div>'''%(cstr(letter_head[0][0]),cstr(self.doc.employee), cstr(self.doc.employee_name), cstr(self.doc.month), cstr(self.doc.fiscal_year), cstr(self.doc.department), cstr(self.doc.branch), cstr(self.doc.designation), cstr(self.doc.grade), cstr(self.doc.bank_account_no), cstr(self.doc.bank_name), cstr(self.doc.arrear_amount), cstr(self.doc.payment_days), earn_table, ded_table, cstr(flt(self.doc.gross_pay)), cstr(flt(self.doc.total_deduction)), cstr(flt(self.doc.net_pay)), cstr(self.doc.total_in_words))
sendmail([receiver], sender='automail@erpnext.com', subject=subj, parts=[['text/plain', msg]])
else:
msgprint("Company Email ID not found.")

View File

@ -1,7 +1,7 @@
# REMEMBER to update this
# ========================
last_patch = 356
last_patch = 360
#-------------------------------------------
@ -269,7 +269,7 @@ def execute(patch_no):
delete_doc('Custom Script', 'Profile-Client')
delete_doc('Custom Script', 'Event-Client')
delete_doc('Custom Script', 'File-Server')
# reload profile with new fields for security
delete_doc('DocType', 'Profile')
reload_doc('core', 'doctype', 'profile')
@ -300,3 +300,20 @@ def execute(patch_no):
sql("update `tabDocField` set print_hide =1 where fieldname in ('pack_no', 'pack_gross_wt', 'weight_uom', 'pack_nett_wt') and parent = 'Delivery Note Detail'")
elif patch_no == 356:
sql("update `tabDocField` set print_hide =1 where fieldname = 'print_packing_slip' and parent = 'Delivery Note'")
elif patch_no == 357:
reload_doc('hr', 'doctype', 'salary_manager')
elif patch_no == 358:
reload_doc('setup', 'doctype','features_setup')
reload_doc('stock','doctype','item')
sql("update tabDocField set label='Produced Qty',description='Updated after finished goods are transferred to FG Warehouse through Stock Entry' where parent='Production Order' and fieldname='produced_qty'")
rs = sql("select fieldname from tabDocField where parent='Features Setup' and fieldname is not null")
from webnotes.model.doc import Document
m = Document('Features Setup')
for d in rs:
m.fields[d[0]] = 1
m.save()
elif patch_no == 359:
reload_doc('hr', 'doctype', 'salary_slip')
delete_doc('DocType', 'Salary Control Panel')
elif patch_no == 360:
sql("delete from `tabDocField` where (fieldname in ('client_string', 'server_code_error', 'server_code_compiled', 'server_code', 'server_code_core', 'client_script', 'client_script_core', 'dt_template', 'change_log') or label = 'Template') and parent = 'DocType'")

View File

@ -499,19 +499,19 @@ class DocType:
def get_child_flat_bom_items(self, item, d):
child_flat_bom_items=[]
if item and (item[0]['is_sub_contracted_item'] == 'Yes' or item[0]['is_pro_applicable'] == 'Yes'):
# if item and (item[0]['is_sub_contracted_item'] == 'Yes' or item[0]['is_pro_applicable'] == 'Yes'):
child_flat_bom_items = sql("select item_code, description, qty_consumed_per_unit, stock_uom, moving_avg_rate, last_purchase_rate, standard_rate, '%s' as parent_bom, bom_mat_no, 'No' as is_pro_applicable from `tabFlat BOM Detail` where parent = '%s' and is_pro_applicable = 'No' and docstatus = 1" % ( d.bom_no, cstr(d.bom_no)))
self.cur_flat_bom_items.append([d.item_code, d.description, flt(d.qty), d.stock_uom, flt(d.moving_avg_rate), flt(d.amount_as_per_mar), flt(d.last_purchase_rate), flt(d.amount_as_per_lpr), flt(d.standard_rate), flt(d.amount_as_per_sr), flt(d.qty_consumed_per_unit), (item[0]['is_sub_contracted_item'] == 'Yes') and d.parent or d.bom_no, d.name, (item[0]['is_sub_contracted_item'] == 'Yes') and 'No' or 'Yes'])
child_flat_bom_items = sql("select item_code, description, qty_consumed_per_unit, stock_uom, moving_avg_rate, last_purchase_rate, standard_rate, '%s' as parent_bom, bom_mat_no, 'No' as is_pro_applicable from `tabFlat BOM Detail` where parent = '%s' and is_pro_applicable = 'No' and docstatus = 1" % ( d.bom_no, cstr(d.bom_no)))
self.cur_flat_bom_items.append([d.item_code, d.description, flt(d.qty), d.stock_uom, flt(d.moving_avg_rate), flt(d.amount_as_per_mar), flt(d.last_purchase_rate), flt(d.amount_as_per_lpr), flt(d.standard_rate), flt(d.amount_as_per_sr), flt(d.qty_consumed_per_unit), (item[0]['is_sub_contracted_item'] == 'Yes') and d.parent or d.bom_no, d.name, (item[0]['is_sub_contracted_item'] == 'Yes') and 'No' or 'Yes'])
return child_flat_bom_items
else:
child_flat_bom_items = sql("select item_code, description, qty_consumed_per_unit, stock_uom, moving_avg_rate, last_purchase_rate, standard_rate, if(parent_bom = '%s', '%s', parent_bom) as parent_bom, bom_mat_no, is_pro_applicable from `tabFlat BOM Detail` where parent = '%s' and docstatus = 1" % ( d.bom_no, d.parent, cstr(d.bom_no)))
# else:
# child_flat_bom_items = sql("select item_code, description, qty_consumed_per_unit, stock_uom, moving_avg_rate, last_purchase_rate, standard_rate, if(parent_bom = '%s', '%s', parent_bom) as parent_bom, bom_mat_no, is_pro_applicable from `tabFlat BOM Detail` where parent = '%s' and docstatus = 1" % ( d.bom_no, d.parent, cstr(d.bom_no)))
if not child_flat_bom_items:
msgprint("Please Submit Child BOM := %s first." % cstr(d.bom_no))
raise Exception
else:
return child_flat_bom_items
# if not child_flat_bom_items:
# msgprint("Please Submit Child BOM := %s first." % cstr(d.bom_no))
# raise Exception
# else:"""
# Get Current Flat BOM Items

View File

@ -13,7 +13,7 @@ sql = webnotes.conn.sql
get_value = webnotes.conn.get_value
in_transaction = webnotes.conn.in_transaction
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
@ -21,7 +21,7 @@ class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
# Autoname
def autoname(self):
p = self.doc.fiscal_year
@ -35,7 +35,7 @@ class DocType:
'default_bom' : item and item[0]['default_bom'] or ''
}
return ret
def validate(self):
if not self.doc.production_item :
msgprint("Please enter Production Item")
@ -62,7 +62,7 @@ class DocType:
if flt(bom_detail[0]['docstatus']) != 1:
msgprint("BOM := '%s' is not Submitted BOM." % self.doc.bom_no)
raise Exception
def update_status(self, status):
# Set Status
if status == 'Stopped':
@ -78,7 +78,7 @@ class DocType:
# Update Planned Qty of Production Item
qty = (flt(self.doc.qty) - flt(self.doc.produced_qty)) * ((status == 'Stopped') and -1 or 1)
get_obj('Warehouse', self.doc.fg_warehouse).update_bin(0, 0, 0, 0, flt(qty), self.doc.production_item, now())
# Acknowledge user
msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s and status has been updated as %s." % (cstr(status), cstr(self.doc.status)))
@ -99,6 +99,6 @@ class DocType:
# Set Status AS "Submitted"
set(self.doc,'status', 'Cancelled')
# decrease Planned Qty of Prooduction Item by Qty
get_obj('Warehouse', self.doc.fg_warehouse).update_bin(0, 0, 0, 0,-flt(self.doc.qty), self.doc.production_item, now())

View File

@ -5,13 +5,14 @@
{
'creation': '2010-08-08 17:09:14',
'docstatus': 0,
'modified': '2010-12-23 11:08:12',
'modified_by': 'umair@iwebnotes.com',
'modified': '2011-08-31 10:03:21',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1313485457',
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 0,
@ -20,7 +21,7 @@
'section_style': 'Tabbed',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 179
'version': 180
},
# These values are common for all DocField
@ -54,7 +55,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 1,
'permlevel': 0,
'role': 'System Manager',
'submit': 1,
@ -64,7 +64,6 @@
# DocPerm
{
'doctype': 'DocPerm',
'idx': 2,
'permlevel': 1,
'role': 'All'
},
@ -75,7 +74,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 3,
'permlevel': 0,
'role': 'Production Manager',
'submit': 1,
@ -88,7 +86,6 @@
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 0,
'role': 'Production User',
'submit': 1,
@ -99,7 +96,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Production Order',
'oldfieldtype': 'Section Break',
'permlevel': 0
@ -112,7 +108,6 @@
'doctype': 'DocField',
'fieldname': 'transaction_date',
'fieldtype': 'Date',
'idx': 2,
'label': 'Transaction Date',
'oldfieldname': 'transaction_date',
'oldfieldtype': 'Date',
@ -127,7 +122,6 @@
'doctype': 'DocField',
'fieldname': 'posting_date',
'fieldtype': 'Date',
'idx': 3,
'label': 'Posting Date',
'oldfieldname': 'posting_date',
'oldfieldtype': 'Date',
@ -142,7 +136,6 @@
'doctype': 'DocField',
'fieldname': 'production_item',
'fieldtype': 'Link',
'idx': 4,
'in_filter': 1,
'label': 'Production Item',
'oldfieldname': 'production_item',
@ -158,7 +151,6 @@
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Text',
'idx': 5,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Text',
@ -173,14 +165,12 @@
'doctype': 'DocField',
'fieldname': 'bom_no',
'fieldtype': 'Link',
'idx': 7,
'label': 'BOM No',
'oldfieldname': 'bom_no',
'oldfieldtype': 'Link',
'options': 'Bill Of Materials',
'permlevel': 1,
'reqd': 1,
'search_index': 0,
'trigger': 'Client'
},
@ -189,7 +179,6 @@
'doctype': 'DocField',
'fieldname': 'origin',
'fieldtype': 'Select',
'idx': 8,
'in_filter': 1,
'label': 'Origin',
'no_copy': 1,
@ -207,7 +196,6 @@
'doctype': 'DocField',
'fieldname': 'qty',
'fieldtype': 'Currency',
'idx': 9,
'label': 'Qty',
'oldfieldname': 'qty',
'oldfieldtype': 'Currency',
@ -221,7 +209,6 @@
'doctype': 'DocField',
'fieldname': 'project_name',
'fieldtype': 'Link',
'idx': 9,
'in_filter': 1,
'label': 'Project Name',
'oldfieldname': 'project_name',
@ -236,7 +223,6 @@
'doctype': 'DocField',
'fieldname': 'amended_from',
'fieldtype': 'Data',
'idx': 10,
'label': 'Amended From',
'oldfieldname': 'amended_from',
'oldfieldtype': 'Data',
@ -248,7 +234,6 @@
'doctype': 'DocField',
'fieldname': 'amendment_date',
'fieldtype': 'Date',
'idx': 11,
'label': 'Amendment Date',
'oldfieldname': 'amendment_date',
'oldfieldtype': 'Date',
@ -259,7 +244,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 12,
'oldfieldtype': 'Column Break',
'permlevel': 0
},
@ -269,7 +253,6 @@
'doctype': 'DocField',
'fieldname': 'stock_uom',
'fieldtype': 'Data',
'idx': 12,
'label': 'Stock UOM',
'oldfieldname': 'stock_uom',
'oldfieldtype': 'Data',
@ -281,7 +264,6 @@
'doctype': 'DocField',
'fieldname': 'status',
'fieldtype': 'Select',
'idx': 13,
'in_filter': 1,
'label': 'Status',
'no_copy': 1,
@ -300,15 +282,13 @@
'doctype': 'DocField',
'fieldname': 'fg_warehouse',
'fieldtype': 'Link',
'idx': 14,
'in_filter': 1,
'label': 'FG Warehouse',
'oldfieldname': 'fg_warehouse',
'oldfieldtype': 'Link',
'options': 'Warehouse',
'permlevel': 0,
'reqd': 1,
'search_index': 0
'reqd': 1
},
# DocField
@ -318,15 +298,13 @@
'doctype': 'DocField',
'fieldname': 'wip_warehouse',
'fieldtype': 'Link',
'idx': 15,
'in_filter': 1,
'label': 'WIP Warehouse',
'oldfieldname': 'wip_warehouse',
'oldfieldtype': 'Link',
'options': 'Warehouse',
'permlevel': 0,
'reqd': 1,
'search_index': 0
'reqd': 1
},
# DocField
@ -336,7 +314,6 @@
'doctype': 'DocField',
'fieldname': 'consider_sa_items',
'fieldtype': 'Select',
'idx': 16,
'in_filter': 1,
'label': 'Consider SA Items',
'oldfieldname': 'consider_sa_items',
@ -349,11 +326,11 @@
# DocField
{
'colour': 'White:FFF',
'description': 'Updated after finished goods are transferred to FG Warehouse through Stock Entry',
'doctype': 'DocField',
'fieldname': 'produced_qty',
'fieldtype': 'Currency',
'idx': 18,
'label': 'Produced Qty (Updated after finished goods are transferred to FG Warehouse through Stock Entry)',
'label': 'Produced Qty',
'oldfieldname': 'produced_qty',
'oldfieldtype': 'Currency',
'permlevel': 1
@ -364,14 +341,12 @@
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
'idx': 19,
'label': 'Company',
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'Company',
'permlevel': 0,
'reqd': 1,
'search_index': 0
'reqd': 1
},
# DocField
@ -379,7 +354,6 @@
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'idx': 20,
'in_filter': 1,
'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year',
@ -393,7 +367,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 21,
'label': 'Next Steps',
'oldfieldtype': 'Section Break',
'permlevel': 0
@ -405,7 +378,6 @@
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 22,
'label': 'Material Transfer',
'oldfieldtype': 'Button',
'permlevel': 0,
@ -416,7 +388,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 23,
'oldfieldtype': 'Column Break',
'permlevel': 0
},
@ -427,7 +398,6 @@
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 24,
'label': 'Backflush',
'oldfieldtype': 'Button',
'permlevel': 0,
@ -438,7 +408,6 @@
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 25,
'oldfieldtype': 'Column Break',
'permlevel': 0
},
@ -449,7 +418,6 @@
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 26,
'label': 'Stop Production Order',
'oldfieldtype': 'Button',
'permlevel': 0,
@ -462,7 +430,6 @@
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 27,
'label': 'Unstop Production Order',
'oldfieldtype': 'Button',
'permlevel': 0,

View File

@ -28,7 +28,7 @@ cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
if(doc.quotation) cur_frm.cscript['Pull Quotation Details'](doc,cdt,cdn);
} else {
cur_frm.cscript.load_taxes(doc, cdt, cdn);
}
}
}
// Refresh
@ -70,7 +70,6 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
} else {
hide_field(['Repair Sales Order', 'Send SMS', 'message', 'customer_mobile_no'])
}
}
//customer

View File

View File

@ -0,0 +1,13 @@
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def validate(self):
"""
update settings in defaults
"""
from webnotes.model import default_fields
from webnotes.utils import set_default
for key in self.doc.fields:
if key not in default_fields:
set_default(key, self.doc.fields[key])

View File

@ -0,0 +1,288 @@
# DocType, Features Setup
[
# These values are common in all dictionaries
{
'creation': '2011-08-25 16:53:56',
'docstatus': 0,
'modified': '2011-08-31 15:05:53',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1314783102',
'colour': 'White:FFF',
'doctype': 'DocType',
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'name_case': 'Title Case',
'section_style': 'Simple',
'show_in_menu': 1,
'version': 16
},
# These values are common for all DocField
{
'doctype': 'DocField',
'name': '__common__',
'parent': 'Features Setup',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'name': '__common__',
'parent': 'Features Setup',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Features Setup
{
'doctype': 'DocType',
'name': 'Features Setup'
},
# DocPerm
{
'doctype': 'DocPerm',
'role': 'System Manager'
},
# DocPerm
{
'doctype': 'DocPerm',
'role': 'Administrator'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'label': 'Materials'
},
# DocField
{
'colour': 'White:FFF',
'description': 'To track item in sales and purchase documents based on their serial nos. This is can also used to track warranty details of the product.',
'doctype': 'DocField',
'fieldname': 'item_searial_nos',
'fieldtype': 'Check',
'label': 'Item Serial Nos'
},
# DocField
{
'colour': 'White:FFF',
'description': 'To track items in sales and purchase documents with batch nos<br><b>Preferred Industry: Chemicals etc</b>',
'doctype': 'DocField',
'fieldname': 'item_batch_nos',
'fieldtype': 'Check',
'label': 'Item Batch Nos'
},
# DocField
{
'colour': 'White:FFF',
'description': 'To track brand name in the following documents<br>\nDelivery Note, Enuiry, Indent, Item, Purchase Order, Purchase Voucher, Purchaser Receipt, Quotation, Receivable Voucher, Sales BOM, Sales Order, Serial No',
'doctype': 'DocField',
'fieldname': 'brands',
'fieldtype': 'Check',
'label': 'Brands'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break'
},
# DocField
{
'colour': 'White:FFF',
'description': '1. To maintain the customer wise item code and to make them searchable based on their code use this option',
'doctype': 'DocField',
'fieldname': 'item_advanced',
'fieldtype': 'Check',
'label': 'Item Advanced'
},
# DocField
{
'colour': 'White:FFF',
'description': 'If Sale BOM is defined, the actual BOM of the Pack is displayed as table.\nAvailable in Delivery Note and Sales Order',
'doctype': 'DocField',
'fieldname': 'packing_details',
'fieldtype': 'Check',
'label': 'Packing Detials'
},
# DocField
{
'colour': 'White:FFF',
'description': 'To get Item Group in details table',
'doctype': 'DocField',
'fieldname': 'item_group_in_details',
'fieldtype': 'Check',
'label': 'Item Groups in Details'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'label': 'Sales and Purchase'
},
# DocField
{
'colour': 'White:FFF',
'description': 'All export related fields like currency, conversion rate, export total, export grand total etc are available in <br>\nDelivery Note, POS, Quotation, Sales Invoice, Sales Order etc.',
'doctype': 'DocField',
'fieldname': 'exports',
'fieldtype': 'Check',
'label': 'Exports'
},
# DocField
{
'colour': 'White:FFF',
'description': 'All import related fields like currency, conversion rate, import total, import grand total etc are available in <br>\nPurchase Receipt, Supplier Quotation, Purchase Invoice, Purchase Order etc.',
'doctype': 'DocField',
'fieldname': 'imports',
'fieldtype': 'Check',
'label': 'Imports'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break'
},
# DocField
{
'colour': 'White:FFF',
'description': 'Field available in Delivery Note, Quotation, Receivable Voucher, Sales Order',
'doctype': 'DocField',
'fieldname': 'discounts',
'fieldtype': 'Check',
'label': 'Discounts'
},
# DocField
{
'colour': 'White:FFF',
'description': 'To track any installation or commissioning related work after sales',
'doctype': 'DocField',
'fieldname': 'after_sales_installations',
'fieldtype': 'Check',
'label': 'After Sale Installations'
},
# DocField
{
'description': 'Available in \nBill Of Materials, Delivery Note, Payable Voucher, Production Order, Purchase Order, Purchase Receipt, Receivable Voucher, Sales Order, Stock Entry, Timesheet',
'doctype': 'DocField',
'fieldname': 'projects',
'fieldtype': 'Check',
'label': 'Projects'
},
# DocField
{
'colour': 'White:FFF',
'description': 'If you have Sales Team and Sale Partners (Channel Partners) they can be tagged and maintain their contribution in the sales activity',
'doctype': 'DocField',
'fieldname': 'sales_extras',
'fieldtype': 'Check',
'label': 'Sales Extras'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'label': 'Production'
},
# DocField
{
'colour': 'White:FFF',
'description': 'If you involve in manufacturing activity<br>\nEnables item <b>Is Manufactured</b>',
'doctype': 'DocField',
'fieldname': 'manufacturing',
'fieldtype': 'Check',
'label': 'Manufacturing'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break'
},
# DocField
{
'colour': 'White:FFF',
'description': 'If you follow Quality Inspection<br>\nEnables item QA Required and QA No in Purchase Receipt',
'doctype': 'DocField',
'fieldname': 'quality',
'fieldtype': 'Check',
'label': 'Quality'
},
# DocField
{
'colour': 'White:FFF',
'description': 'To enable <b>Point of Sale</b> features',
'doctype': 'DocField',
'fieldname': 'pos',
'fieldtype': 'Check',
'label': 'Point of Sale'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'label': 'Miscelleneous'
},
# DocField
{
'colour': 'White:FFF',
'description': 'If you have long print formats, this feature can be used to split the page to be printed on multiple pages with all headers and footers on each page',
'doctype': 'DocField',
'fieldname': 'page_break',
'fieldtype': 'Check',
'label': 'Page Break'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break'
},
# DocField
{
'colour': 'White:FFF',
'description': 'Enables <b>More Info.</b> in all documents',
'doctype': 'DocField',
'fieldname': 'more_info',
'fieldtype': 'Check',
'label': 'More Info'
}
]

View File

@ -172,7 +172,8 @@ SetupData = function(cnty){
['Property Setter',1,'Property Setter','', 'Customize properties of a Form (DocType) or Field'],
['Letter Head',1,'Letter Head','','Manage different letter heads for Prints'],
['SMS Settings',3,'SMS Settings','','Integrate your personalized SMS gateway which support http web service'],
['SMS Center',3,'SMS Center','','Send mass sms to your leads, contacts and partners']
['SMS Center',3,'SMS Center','','Send mass sms to your leads, contacts and partners'],
['Features Setup',3,'Features Setup','','Displays fields based on features selected']
]};

View File

@ -12,8 +12,8 @@ if(inList(user_roles,'System Manager')) is_system_manager = 1;
function startup_setup() {
pscript.is_erpnext_saas = cint(locals['Control Panel']['Control Panel'].sync_with_gateway)
if(get_url_arg('embed')) {
// hide header, footer
$dh(page_body.banner_area);
@ -34,7 +34,7 @@ function startup_setup() {
$td(page_body.wntoolbar.body_tab,0,0).innerHTML = '<i><b>erp</b>next</i>';
$y($td(page_body.wntoolbar.body_tab,0,0), {width:'140px', color:'#FFF', paddingLeft:'8px', paddingRight:'8px', fontSize:'14px'})
$dh(page_body.banner_area);
// sidebar
// -------
pscript.startup_make_sidebar();
@ -65,10 +65,10 @@ pscript.startup_make_sidebar = function() {
var callback = function(r,rt) {
// menu
var ml = r.message;
// clear
page_body.left_sidebar.innerHTML = '';
for(var m=0; m<ml.length; m++){
if(ml[m]) {
new SidebarItem(ml[m]);
@ -79,13 +79,13 @@ pscript.startup_make_sidebar = function() {
$(div).html('[edit]').click(pscript.startup_set_module_order)
}
nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }});
// select current
var no = nav_obj.ol[nav_obj.ol.length-1];
if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
}
$c_obj('Home Control', 'get_modules', '', callback);
$c_obj('Home Control', 'get_modules', '', callback);
}
// ====================================================================
@ -97,13 +97,13 @@ var menu_item_map = {'Form':{}, 'Page':{}, 'Report':{}, 'List':{}}
pscript.select_sidebar_menu = function(t, dt, dn) {
// get menu item
if(menu_item_map[t][dt]) {
if(menu_item_map[t][dt]) {
// select
menu_item_map[t][dt].select();
} else {
// none found :-( Unselect
if(cur_menu_pointer)
cur_menu_pointer.deselect();
cur_menu_pointer.deselect();
}
}
@ -115,19 +115,19 @@ var body_background = '#e2e2e2';
MenuPointer = function(parent, label) {
this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
$br(this.wrapper, '3px');
this.tab = make_table($a(this.wrapper, 'div'), 1, 2, '100%', ['', '11px'], {height:'22px',
this.tab = make_table($a(this.wrapper, 'div'), 1, 2, '100%', ['', '11px'], {height:'22px',
verticalAlign:'middle', padding:'0px'}, {borderCollapse:'collapse', tableLayout:'fixed'});
$y($td(this.tab, 0, 0), {padding:'0px 4px', color:'#444', whiteSpace:'nowrap'});
// triangle border (?)
this.tab.triangle_div = $a($td(this.tab, 0, 1), 'div','', {
borderColor: body_background + ' ' + body_background + ' ' + body_background + ' ' + 'transparent',
borderColor: body_background + ' ' + body_background + ' ' + body_background + ' ' + 'transparent',
borderWidth:'11px', borderStyle:'solid', height:'0px', width:'0px', marginRight:'-11px'});
this.label_area = $a($td(this.tab, 0, 0), 'span', '', '', label);
$(this.wrapper)
@ -135,7 +135,7 @@ MenuPointer = function(parent, label) {
function() { if(!this.selected)$bg(this, '#eee'); } ,
function() { if(!this.selected)$bg(this, body_background); }
)
$y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
}
@ -150,14 +150,14 @@ MenuPointer.prototype.select = function(grey) {
if(cur_menu_pointer && cur_menu_pointer != this)
cur_menu_pointer.deselect();
cur_menu_pointer = this;
}
// ====================================================================
MenuPointer.prototype.deselect = function() {
$y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
$y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
$gr(this.wrapper, body_background, body_background);
this.selected = 0;
}
@ -176,19 +176,19 @@ SidebarItem = function(det) {
this.body = $a(this.wrapper, 'div');
this.tab = make_table(this.body, 1, 2, '100%', ['24px', null], {verticalAlign:'middle'}, {tableLayout:'fixed'});
// icon
var ic = $a($td(this.tab, 0, 0), 'div', 'module-icons module-icons-' + det.module_label.toLowerCase(), {marginLeft:'3px', marginBottom:'-2px'});
// pointer table
this.pointer = new MenuPointer($td(this.tab, 0, 1), det.module_label);
this.pointer = new MenuPointer($td(this.tab, 0, 1), det.module_label);
$y($td(this.pointer.tab, 0, 0), {fontWeight:'bold'});
// for page type
if(det.module_page) {
menu_item_map.Page[det.module_page] = this.pointer;
}
// items area
this.items_area = $a(this.wrapper, 'div');
@ -203,14 +203,14 @@ SidebarItem.prototype.onclick = function() {
if(this.det.module_page) {
// page type
this.pointer.select();
$item_set_working(me.pointer.label_area);
loadpage(this.det.module_page, function() { $item_done_working(me.pointer.label_area); });
} else {
// show sub items
this.toggle();
}
}
}
// ====================================================================
@ -225,7 +225,7 @@ SidebarItem.prototype.collapse = function() {
SidebarItem.prototype.toggle = function() {
if(this.loading) return;
if(this.is_open) {
this.collapse();
} else {
@ -234,7 +234,7 @@ SidebarItem.prototype.toggle = function() {
this.is_open = 1;
$fg(this.pointer.label_area, '#000')
//this.pointer.select(1);
// close existing open
if(cur_sidebar_item && cur_sidebar_item != this) {
cur_sidebar_item.collapse();
@ -248,7 +248,7 @@ SidebarItem.prototype.toggle = function() {
SidebarItem.prototype.show_items = function() {
this.loading = 1;
var me = this;
$item_set_working(this.pointer.label_area);
var callback = function(r,rt){
me.loaded = 1;
@ -256,10 +256,10 @@ SidebarItem.prototype.show_items = function() {
var smi = null;
var has_reports = 0;
var has_tools = 0;
// widget code
$item_done_working(me.pointer.label_area);
if(r.message.il) {
me.il = r.message.il;
@ -268,13 +268,13 @@ SidebarItem.prototype.show_items = function() {
if(me.il[i].doc_type == 'Forms') {
if(in_list(profile.can_read, me.il[i].doc_name)) {
var smi = new SidebarModuleItem(me, me.il[i]);
menu_item_map['Form'][me.il[i].doc_name] = smi.pointer;
menu_item_map['List'][me.il[i].doc_name] = smi.pointer;
}
}
if(me.il[i].doc_type=='Reports') has_reports = 1;
if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type)) has_tools = 1;
if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type)) has_tools = 1;
}
// reports
if(has_reports) {
@ -291,7 +291,7 @@ SidebarItem.prototype.show_items = function() {
// add to menu-item mapper
menu_item_map['Page'][me.det.module_label + ' Tools'] = smi.pointer;
}
// custom reports
if(r.message.custom_reports.length) {
me.il = add_lists(r.message.il, r.message.custom_reports);
@ -301,7 +301,7 @@ SidebarItem.prototype.show_items = function() {
menu_item_map['Page'][me.det.module_label + ' Custom Reports'] = smi.pointer;
}
}
$(me.items_area).slideDown();
@ -309,9 +309,9 @@ SidebarItem.prototype.show_items = function() {
var no = nav_obj.ol[nav_obj.ol.length-1];
if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
}
$c_obj('Home Control', 'get_module_details', me.det.name, callback);
}
@ -323,7 +323,7 @@ SidebarItem.prototype.show_section = function(sec_type) {
var me = this;
var label = this.det.module_label + ' ' + sec_type;
var type_map = {'Reports':'Reports', 'Custom Reports':'Custom Reports', 'Pages':'Tools', 'Single DocType':'Tools', 'Setup Forms':'Tools'}
if(page_body.pages[label]) {
loadpage(label, null, 1);
} else {
@ -331,10 +331,10 @@ SidebarItem.prototype.show_section = function(sec_type) {
var page = page_body.add_page(label);
this.wrapper = $a(page,'div','layout_wrapper');
// head
this.head = new PageHeader(this.wrapper, label);
// body
this.body1 = $a(this.wrapper, 'div', '', {marginTop:'16px'});
@ -342,18 +342,18 @@ SidebarItem.prototype.show_section = function(sec_type) {
var add_link = function(det) {
var div = $a(me.body1, 'div', '', {marginBottom:'6px'});
var span = $a(div, 'span', 'link_type');
// tag the span
span.innerHTML = det.display_name; span.det = det;
if(sec_type=='Reports' || sec_type=='Custom Reports') {
// Reports
// -------
span.onclick = function() { loadreport(this.det.doc_name, this.det.display_name); }
} else {
// Tools
// -----
if(det.doc_type=='Pages') {
// Page
if(det.click_function) {
@ -364,18 +364,18 @@ SidebarItem.prototype.show_section = function(sec_type) {
}
} else if(det.doc_type=='Setup Forms') {
// Doc Browser
span.onclick = function() { loaddocbrowser(this.det.doc_name); }
span.onclick = function() { loaddocbrowser(this.det.doc_name); }
} else {
// Single
span.onclick = function() { loaddoc(this.det.doc_name, this.det.doc_name); }
span.onclick = function() { loaddoc(this.det.doc_name, this.det.doc_name); }
}
}
}
// item list
for(var i=0; i<me.il.length;i++){
if(type_map[me.il[i].doc_type] == sec_type) {
add_link(me.il[i]);
add_link(me.il[i]);
}
}
loadpage(label, null, 1);
@ -390,11 +390,11 @@ SidebarItem.prototype.show_section = function(sec_type) {
SidebarModuleItem = function(si, det) {
this.det = det;
var me= this;
this.pointer = new MenuPointer(si.items_area, get_doctype_label(det.doc_name));
this.pointer = new MenuPointer(si.items_area, get_doctype_label(det.doc_name));
$y(si.items_area, {marginLeft:'32px'})
$y($td(this.pointer.tab, 0, 0), {fontSize:'11px'});
this.pointer.wrapper.onclick = function() {
if(me.det.doc_type=='Forms')
loaddocbrowser(det.doc_name);
@ -416,10 +416,10 @@ pscript.startup_set_module_order = function() {
}
$c_obj('Home Control', 'set_module_order', JSON.stringify(mdict), function(r,rt) { pscript.startup_make_sidebar(); } )
}
var callback = function(r, rt) {
var ml = [];
for(var i=0; i<r.message.length; i++) {
for(var i=0; i<r.message.length; i++) {
var det = r.message[i];
ml.push([det[1], det[2], (det[3]!='No' ? 0 : 1), det[0]]);
}
@ -427,7 +427,7 @@ pscript.startup_set_module_order = function() {
'<br><b>Note:</b> <i>These changes will apply to all users!</i>', ml, update_order, 1);
}
$c_obj('Home Control', 'get_module_order', '', callback)
}
// ====================================================================
@ -437,7 +437,7 @@ pscript.startup_setup_toolbar = function() {
// Profile
// ---------
$td(menu_tab,0,0).innerHTML = '<a style="font-weight: bold; color: #FFF" href="javascript:'+"loadpage('profile-settings')"+'">'+user_fullname+'</a>';
if(pscript.is_erpnext_saas){
// Help
// --------------
@ -474,7 +474,7 @@ show_chart_browser = function(nm, chart_type){
var call_back = function(){
if(nm == 'Sales Browser'){
var sb_obj = new SalesBrowser();
sb_obj.set_val(chart_type);
sb_obj.set_val(chart_type);
}
else if(nm == 'Accounts Browser')
pscript.make_chart(chart_type);
@ -501,7 +501,7 @@ ModulePage = function(parent, module_name, module_label, help_page, callback) {
var btn = this.page_head.add_button('Help', function() { loadpage(this.help_page) }, 1, 'ui-icon-help')
btn.help_page = help_page;
}
if(callback) this.callback = function(){ callback(); }
}
@ -517,12 +517,12 @@ get_plural = function(str){
// set user fullname
// ====================================================================
pscript.set_user_fullname = function(ele,username,get_latest){
var set_it = function(){
if(ele)
ele.innerHTML = user_full_nm[username];
}
if(get_latest){
$c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); });
}
@ -530,7 +530,7 @@ pscript.set_user_fullname = function(ele,username,get_latest){
if(user_full_nm[username]){
set_it();
}
else
$c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); });
}
@ -539,4 +539,182 @@ pscript.set_user_fullname = function(ele,username,get_latest){
// ====================================================================
startup_setup();
$(document).bind('form_refresh', function() { })
/* features setup "Dictionary", "Script"
Dictionary Format
'projects': {
'Sales Order': {
'fields':['project_name'],
'sales_order_details':['projected_qty']
},
'Purchase Order': {
'fields':['project_name']
}
}
// ====================================================================*/
pscript.feature_dict = {
'projects': {
'Bill Of Materials': {'fields':['project_name']},
'Delivery Note': {'fields':['project_name']},
'Payable Voucher': {'fields':['project_name']},
'Production Order': {'fields':['project_name']},
'Purchase Order': {'fields':['project_name']},
'Purchase Receipt': {'fields':['project_name']},
'Receivable Voucher': {'fields':['project_name']},
'Sales Order': {'fields':['project_name']},
'Stock Entry': {'fields':['project_name']},
'Timesheet': {'timesheet_details':['project_name']}
},
'packing_details': {
'Delivery Note': {'fields':['packing_details','print_packing_slip'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']},
'Sales Order': {'fields':['packing_details']}
},
'discounts': {
'Delivery Note': {'delivery_note_details':['adj_rate']},
'Quotation': {'quotation_details':['adj_rate']},
'Receivable Voucher': {'entries':['adj_rate']},
'Sales Order': {'sales_order_details':['adj_rate','ref_rate']}
},
'brands': {
'Delivery Note': {'delivery_note_details':['brand']},
'Indent': {'indent_details':['brand']},
'Item': {'fields':['brand']},
'Purchase Order': {'po_details':['brand']},
'Payable Voucher': {'entries':['brand']},
'Quotation': {'quotation_details':['brand']},
'Receivable Voucher': {'entries':['brand']},
'Sales BOM': {'fields':['new_item_brand']},
'Sales Order': {'sales_order_details':['brand']},
'Serial No': {'fields':['brand']}
},
'after_sales_installations': {
'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']}
},
'item_batch_nos': {
'Delivery Note': {'delivery_note_details':['batch_no']},
'Item': {'fields':['has_batch_no']},
'Purchase Receipt': {'purchase_receipt_details':['batch_no']},
'QA Inspection Report': {'fields':['batch_no']},
'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
'Receivable Voucher': {'entries':['batch_no']},
'Stock Entry': {'mtn_details':['batch_no']},
'Stock Ledger Entry': {'fields':['batch_no']}
},
'item_serial_nos': {
'Customer Issue': {'fields':['serial_no']},
'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']},
'Installation Note': {'installed_item_details':['serial_no']},
'Item': {'fields':['has_serial_no']},
'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']},
'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
'QA Inspection Report': {'fields':['item_serial_no']},
'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
'Receivable Voucher': {'entries':['serial_no']},
'Stock Entry': {'mtn_details':['serial_no']},
'Stock Ledger Entry': {'fields':['serial_no']}
},
'item_group_in_details': {
'Delivery Note': {'delivery_note_details':['item_group']},
'Enquiry': {'enquiry_details':['item_group']},
'Indent': {'indent_details':['item_group']},
'Item': {'fields':['item_group']},
'Manage Account': {'fields':['default_item_group']},
'Purchase Order': {'po_details':['item_group']},
'Purchase Receipt': {'purchase_receipt_details':['item_group']},
'Purchase Voucher': {'entries':['item_group']},
'Quotation': {'quotation_details':['item_group']},
'Receivable Voucher': {'entries':['item_group']},
'Sales BOM': {'fields':['serial_no']},
'Sales Order': {'sales_order_details':['item_group']},
'Serial No': {'fields':['item_group']},
'Sales Partner': {'partner_target_details':['item_group']},
'Sales Person': {'target_details':['item_group']},
'Territory': {'target_details':['item_group']}
},
'page_break': {
'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']},
'Indent': {'indent_details':['page_break']},
'Purchase Order': {'po_details':['page_break']},
'Purchase Receipt': {'purchase_receipt_details':['page_break']},
'Purchase Voucher': {'entries':['page_break']},
'Quotation': {'quotation_details':['page_break']},
'Receivable Voucher': {'entries':['page_break']},
'Sales Order': {'sales_order_details':['page_break']}
},
'exports': {
'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']},
'POS Setting': {'fields':['conversion_rate','currency']},
'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']},
'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']},
'Item': {'ref_rate_details':['ref_currency']},
'Sales BOM': {'fields':['currency']},
'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']}
},
'imports': {
'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']},
'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']},
'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']},
'Supplier Quotation': {'fields':['conversion_rate','currency']}
},
'item_advanced': {
'Item': {'fields':['item_customer_details']}
},
'sales_extras': {
'Address': {'fields':['sales_partner']},
'Contact': {'fields':['sales_partner']},
'Customer': {'fields':['sales_team']},
'Delivery Note': {'fields':['sales_team','Packing List']},
'Item': {'fields':['item_customer_details']},
'Receivable Voucher': {'fields':['sales_team']},
'Sales Order': {'fields':['sales_team','Packing List']}
},
'more_info': {
'Customer': {'fields':['More Info']},
'Delivery Note': {'fields':['More Info']},
'Enquiry': {'fields':['More Info']},
'Indent': {'fields':['More Info']},
'Lead': {'fields':['More Info']},
'Payable Voucher': {'fields':['More Info']},
'Purchase Order': {'fields':['More Info']},
'Purchase Receipt': {'fields':['More Info']},
'Quotation': {'fields':['More Info']},
'Receivable Voucher': {'fields':['More Info']},
'Sales Order': {'fields':['More Info']},
'Serial No': {'fields':['More Info']},
'Supplier': {'fields':['More Info']}
},
'quality': {
'Item': {'fields':['Item Inspection Criteria','inspection_required']},
'Purchase Receipt': {'purchase_receipt_details':['qa_no']}
},
'manufacturing': {
'Item': {'fields':['Manufacturing']}
},
'pos': {
'Receivable Voucher': {'fields':['is_pos']}
}
}
$(document).bind('form_refresh', function() {
for(sys_feat in sys_defaults)
{
if(sys_defaults[sys_feat]=='0' && (sys_feat in pscript.feature_dict)) //"Features to hide" exists
{
if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat])
{
for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype])
{
if(fort=='fields')
hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
else if(cur_frm.fields_dict[fort])
{
for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort])
cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false);
}
else
msgprint('Grid "'+fort+'" does not exists');
}
}
}
}
})

View File

@ -110,3 +110,9 @@ cur_frm.cscript.weight_to_validate = function(doc,cdt,cdn){
cur_frm.cscript.validate = function(doc,cdt,cdn){
cur_frm.cscript.weight_to_validate(doc,cdt,cdn);
}
//===========Fill Default Currency in "Ref Rate Details====================
cur_frm.fields_dict['ref_rate_details'].grid.onrowadd = function(doc, cdt, cdn){
locals[cdt][cdn].ref_currency = sys_defaults.currency;
refresh_field('ref_currency',cdn,'ref_rate_details');
}

View File

@ -5,8 +5,8 @@
{
'creation': '2010-08-08 17:09:19',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'umair@iwebnotes.com',
'modified': '2011-08-31 11:36:41',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
@ -23,7 +23,7 @@
'section_style': 'Tray',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 2
'version': 3
},
# These values are common for all DocField
@ -34,7 +34,8 @@
'parent': 'Ref Rate Detail',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
'permlevel': 0,
'search_index': 1
},
# DocType, Ref Rate Detail
@ -48,13 +49,12 @@
'doctype': 'DocField',
'fieldname': 'price_list_name',
'fieldtype': 'Select',
'idx': 1,
'label': 'Price List Name',
'oldfieldname': 'price_list_name',
'oldfieldtype': 'Select',
'options': 'link:Price List',
'reqd': 1,
'search_index': 1
'trigger': 'Client'
},
# DocField
@ -62,12 +62,10 @@
'doctype': 'DocField',
'fieldname': 'ref_rate',
'fieldtype': 'Currency',
'idx': 2,
'label': 'Ref Rate',
'oldfieldname': 'ref_rate',
'oldfieldtype': 'Currency',
'reqd': 0,
'search_index': 0
'reqd': 0
},
# DocField
@ -75,12 +73,10 @@
'doctype': 'DocField',
'fieldname': 'ref_currency',
'fieldtype': 'Select',
'idx': 3,
'label': 'Currency',
'oldfieldname': 'ref_currency',
'oldfieldtype': 'Select',
'options': 'link:Currency',
'reqd': 1,
'search_index': 1
'reqd': 1
}
]