Merged with upstream master

This commit is contained in:
Brahma K
2011-08-16 12:27:48 +05:30
65 changed files with 1294 additions and 1207 deletions

View File

@@ -72,16 +72,6 @@ cur_frm.fields_dict['master_name'].get_query=function(doc){
else alert("Please select master type"); else alert("Please select master type");
} }
/*
// Get customer/supplier address
// -----------------------------------------
cur_frm.cscript.master_name = function(doc,cdt,cdn){
if(doc.master_name){
get_server_fields('get_address','','',doc,cdt,cdn);
}
}
*/
// parent account get query // parent account get query
// ----------------------------------------- // -----------------------------------------
cur_frm.fields_dict['parent_account'].get_query = function(doc){ cur_frm.fields_dict['parent_account'].get_query = function(doc){

View File

@@ -455,7 +455,8 @@
'description': "Don't delete this field at any cost", 'description': "Don't delete this field at any cost",
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'old_parent', 'fieldname': 'old_parent',
'fieldtype': 'Data', 'fieldtype': 'Link',
'options': 'Account',
'hidden': 1, 'hidden': 1,
'idx': 24, 'idx': 24,
'label': 'Old Parent', 'label': 'Old Parent',

View File

@@ -45,5 +45,5 @@ class DocType:
def update_details(self): def update_details(self):
for d in getlist(self.doclist, 'entries'): for d in getlist(self.doclist, 'entries'):
if d.clearance_date: if d.clearance_date:
sql("update `tabJournal Voucher` set clearance_date = %s where name=%s", (d.clearance_date, d.voucher_id)) sql("update `tabJournal Voucher` set clearance_date = %s, modified = %s where name=%s", (d.clearance_date, nowdate(), d.voucher_id))
msgprint("Updated") msgprint("Updated")

View File

@@ -31,7 +31,7 @@ class DocType:
ret = { ret = {
'company_abbr' : abbr 'company_abbr' : abbr
} }
return cstr(ret) return ret
def validate(self): def validate(self):
# Cost Center name must be unique # Cost Center name must be unique

View File

@@ -39,7 +39,7 @@ class DocType(TransactionBase):
'company_address': cstr(comp_det[0][0]), 'company_address': cstr(comp_det[0][0]),
'registration_details': cstr(comp_det[0][1]) 'registration_details': cstr(comp_det[0][1])
} }
return cstr(ret) return ret
# Get party details # Get party details
#------------------ #------------------

View File

@@ -1,9 +1,5 @@
cur_frm.cscript.onload = function(doc, cdt, cdn) { cur_frm.cscript.onload = function(doc, cdt, cdn) {
var cp = locals['Control Panel']['Control Panel']; var cp = locals['Control Panel']['Control Panel'];
if(doc.__islocal){
doc.clearance_date ='';
refresh_field('clearance_date');
}
if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date()); if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date());

View File

@@ -38,9 +38,9 @@ class DocType:
args = eval(args) args = eval(args)
o_s = sql("select outstanding_amount from `tab%s` where name = '%s'" % (args['doctype'],args['docname'])) o_s = sql("select outstanding_amount from `tab%s` where name = '%s'" % (args['doctype'],args['docname']))
if args['doctype'] == 'Payable Voucher': if args['doctype'] == 'Payable Voucher':
return cstr({'debit': o_s and flt(o_s[0][0]) or 0}) return {'debit': o_s and flt(o_s[0][0]) or 0}
if args['doctype'] == 'Receivable Voucher': if args['doctype'] == 'Receivable Voucher':
return cstr({'credit': o_s and flt(o_s[0][0]) or 0}) return {'credit': o_s and flt(o_s[0][0]) or 0}
#-------------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------------
# Create remarks # Create remarks

View File

@@ -48,14 +48,14 @@ class DocType(TransactionBase):
ret['due_date'] = add_days(cstr(self.doc.posting_date), acc_head and cint(acc_head[0][1]) or 0) ret['due_date'] = add_days(cstr(self.doc.posting_date), acc_head and cint(acc_head[0][1]) or 0)
elif not acc_head: elif not acc_head:
msgprint("%s does not have an Account Head in %s. You must first create it from the Supplier Master" % (self.doc.supplier, self.doc.company)) msgprint("%s does not have an Account Head in %s. You must first create it from the Supplier Master" % (self.doc.supplier, self.doc.company))
return cstr(ret) return ret
def get_cust(self): def get_cust(self):
ret = {} ret = {}
if self.doc.credit_to: if self.doc.credit_to:
ret['supplier'] = get_value('Account',self.doc.credit_to,'master_name') ret['supplier'] = get_value('Account',self.doc.credit_to,'master_name')
return cstr(ret) return ret
# Get Default Cost Center and Expense Head from Item Master # Get Default Cost Center and Expense Head from Item Master
@@ -70,7 +70,7 @@ class DocType(TransactionBase):
if not args['cost_center'] or args['cost_center'] == 'undefined': if not args['cost_center'] or args['cost_center'] == 'undefined':
cost_center = sql("select cost_center from `tabItem` where name = '%s'" % args['item_code']) cost_center = sql("select cost_center from `tabItem` where name = '%s'" % args['item_code'])
ret['cost_center'] = cost_center and cost_center[0][0] or '' ret['cost_center'] = cost_center and cost_center[0][0] or ''
return cstr(ret) return ret
# Get Items based on PO or PR # Get Items based on PO or PR
@@ -115,7 +115,7 @@ class DocType(TransactionBase):
'cost_center' : item_det and item_det[0]['cost_center'] or '', 'cost_center' : item_det and item_det[0]['cost_center'] or '',
'item_tax_rate' : str(t) 'item_tax_rate' : str(t)
} }
return cstr(ret) return ret
# Advance Allocation # Advance Allocation
# ------------------- # -------------------
@@ -139,7 +139,7 @@ class DocType(TransactionBase):
def get_rate1(self,acc): def get_rate1(self,acc):
rate = sql("select tax_rate from `tabAccount` where name='%s'"%(acc)) rate = sql("select tax_rate from `tabAccount` where name='%s'"%(acc))
ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 } ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 }
return cstr(ret) return ret
# *************************** Server Utility Functions ***************************** # *************************** Server Utility Functions *****************************

View File

@@ -129,7 +129,7 @@ class DocType:
# save # save
le.save(1) le.save(1)
le_obj.on_update(adv_adj = '') le_obj.on_update(adv_adj = '', cancel = '')
# Reposting Balances # Reposting Balances

View File

@@ -90,7 +90,7 @@ class DocType(TransactionBase):
def get_debit_to(self): def get_debit_to(self):
acc_head = self.get_customer_account() acc_head = self.get_customer_account()
if acc_head: if acc_head:
return cstr({ 'debit_to' : acc_head }) return { 'debit_to' : acc_head }
# Set Due Date = Posting Date + Credit Days # Set Due Date = Posting Date + Credit Days
@@ -515,7 +515,7 @@ class DocType(TransactionBase):
ret = { ret = {
'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0 'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
} }
return cstr(ret) return ret
# Make GL Entries # Make GL Entries
# ------------------------- # -------------------------

View File

@@ -34,7 +34,7 @@ class DocType:
else: else:
ret = { 'registration_details': cstr(comp_det[0][0])} ret = { 'registration_details': cstr(comp_det[0][0])}
return cstr(ret) return ret
# Get default bank and tds account # Get default bank and tds account
#------------------------------------ #------------------------------------

View File

@@ -51,7 +51,6 @@ for r in res:
q1 = "select sum(t1.budget_allocated) from `tabBudget Detail` t1, `tab%s` t2, `tabAccount` t3 where " q1 = "select sum(t1.budget_allocated) from `tabBudget Detail` t1, `tab%s` t2, `tabAccount` t3 where "
cond2 = " t3.is_pl_account = 'Yes' and t3.debit_or_credit = 'Debit' and t3.name = t1.account and t1.docstatus != 2 and " cond2 = " t3.is_pl_account = 'Yes' and t3.debit_or_credit = 'Debit' and t3.name = t1.account and t1.docstatus != 2 and "
if ch: if ch:
qur = q1+cond2+cond1+" and t2.name = '%s'" qur = q1+cond2+cond1+" and t2.name = '%s'"
ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip())) ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))

View File

@@ -84,7 +84,7 @@ class DocType(TransactionBase):
# ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query) # ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where supplier = '%s' and is_supplier = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1) contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where supplier = '%s' and is_supplier = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or '' ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
return cstr(ret) return ret
else: else:
msgprint("Supplier : %s does not exists" % (name)) msgprint("Supplier : %s does not exists" % (name))
raise Exception raise Exception
@@ -142,14 +142,14 @@ class DocType(TransactionBase):
ret['purchase_rate'] = item and flt(item[0]['last_purchase_rate']) or 0 ret['purchase_rate'] = item and flt(item[0]['last_purchase_rate']) or 0
ret['import_rate'] = flt(item and flt(item[0]['last_purchase_rate']) or 0) / flt(obj.doc.fields.has_key('conversion_rate') and flt(obj.doc.conversion_rate) or 1) ret['import_rate'] = flt(item and flt(item[0]['last_purchase_rate']) or 0) / flt(obj.doc.fields.has_key('conversion_rate') and flt(obj.doc.conversion_rate) or 1)
return cstr(ret) return ret
# Get Available Qty at Warehouse # Get Available Qty at Warehouse
def get_bin_details( self, arg = ''): def get_bin_details( self, arg = ''):
arg = eval(arg) arg = eval(arg)
bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (arg['item_code'], arg['warehouse']), as_dict=1) bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (arg['item_code'], arg['warehouse']), as_dict=1)
ret = { 'projected_qty' : bin and flt(bin[0]['projected_qty']) or 0 } ret = { 'projected_qty' : bin and flt(bin[0]['projected_qty']) or 0 }
return str(ret) return ret
# Get UOM Details # Get UOM Details
def get_uom_details(self, arg = ''): def get_uom_details(self, arg = ''):
@@ -163,7 +163,7 @@ class DocType(TransactionBase):
'purchase_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])) or 0 'purchase_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])) or 0
} }
return str(ret) return ret
# get last purchase rate # get last purchase rate
def get_last_purchase_rate( self, obj): def get_last_purchase_rate( self, obj):
@@ -522,7 +522,7 @@ class DocType(TransactionBase):
'rate' : rate and (rate[0]['account_type'] == 'Tax' and not arg['charge_type'] == 'Actual') and flt(rate[0]['tax_rate']) or 0 'rate' : rate and (rate[0]['account_type'] == 'Tax' and not arg['charge_type'] == 'Actual') and flt(rate[0]['tax_rate']) or 0
} }
#msgprint(ret) #msgprint(ret)
return cstr(ret) return ret

View File

@@ -38,23 +38,17 @@ class DocType(TransactionBase):
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'PO Date') get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'PO Date')
# Client Trigger Functions
#----------------------------------------------------------------------------------------------------
# Get Supplier Details
#def get_supplier_details(self, name = ''):
#return cstr(get_obj(dt='Purchase Common').get_supplier_details(name))
# Get Item Details # Get Item Details
def get_item_details(self, arg =''): def get_item_details(self, arg =''):
return cstr(get_obj(dt='Purchase Common').get_item_details(self,arg)) return get_obj(dt='Purchase Common').get_item_details(self,arg)
# Get UOM Details # Get UOM Details
def get_uom_details(self, arg = ''): def get_uom_details(self, arg = ''):
return cstr(get_obj(dt='Purchase Common').get_uom_details(arg)) return get_obj(dt='Purchase Common').get_uom_details(arg)
# get available qty at warehouse # get available qty at warehouse
def get_bin_details(self, arg = ''): def get_bin_details(self, arg = ''):
return cstr(get_obj(dt='Purchase Common').get_bin_details(arg)) return get_obj(dt='Purchase Common').get_bin_details(arg)
# Pull Indent # Pull Indent
def get_indent_details(self): def get_indent_details(self):

View File

@@ -18,7 +18,7 @@ class DocType:
'supplier_name' : cd and cd[0][4] or '', 'supplier_name' : cd and cd[0][4] or '',
'supplier_address': cd and cd[0][5] or '' 'supplier_address': cd and cd[0][5] or ''
} }
return cstr(ret) return ret
def get_rfq_details(self): def get_rfq_details(self):
self.doc.clear_table(self.doclist, 'supplier_quotation_details') self.doc.clear_table(self.doclist, 'supplier_quotation_details')
@@ -28,12 +28,12 @@ class DocType:
def update_approval_status(self): def update_approval_status(self):
if not self.doc.approval_status or self.doc.approval_status == 'Not Approved': if not self.doc.approval_status or self.doc.approval_status == 'Not Approved':
set(self.doc, 'approval_status','Approved') set(self.doc, 'approval_status','Approved')
return cstr(self.doc.approval_status) return self.doc.approval_status
elif self.doc.approval_status == 'Approved': elif self.doc.approval_status == 'Approved':
pc_obj = get_obj('Purchase Common') pc_obj = get_obj('Purchase Common')
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail') pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
set(self.doc, 'approval_status', 'Not Approved') set(self.doc, 'approval_status', 'Not Approved')
return cstr(self.doc.approval_status) return self.doc.approval_status
def validate_item_list(self): def validate_item_list(self):
if not getlist(self.doclist, 'supplier_quotation_details'): if not getlist(self.doclist, 'supplier_quotation_details'):
@@ -101,4 +101,4 @@ class DocType:
# Get Supplier Details # Get Supplier Details
# -------------------- # --------------------
def get_supplier_details(self, name = ''): def get_supplier_details(self, name = ''):
return cstr(get_obj('Purchase Common').get_supplier_details(name)) return get_obj('Purchase Common').get_supplier_details(name)

View File

@@ -15,3 +15,48 @@ span.home-status-unread {
color: #FFF; color: #FFF;
background-color: RED; background-color: RED;
} }
div.setup-wizard {
display: none;
margin: 13px 0px;
background-color: #FED;
padding: 13px;
}
div.setup-wizard .header {
font-size: 12px;
font-weight: bold;
color: #322;
margin-bottom: 7px;
}
div.setup-wizard .percent-outer {
height: 17px;
background-color: #FFF;
border: 2px solid #322;
}
div.setup-wizard .percent-inner {
height: 17px;
background-color: GREEN;
}
div.setup-wizard .suggestion {
margin: 7px 0px;
color: #322;
}
div.setup-wizard .prev-next {
height: 13px;
}
div.setup-wizard .prev-next span {
display: none;
float: right;
margin-left: 13px;
color: #877;
font-size: 11px;
}

View File

@@ -24,8 +24,8 @@ pscript.home_make_body = function() {
wrapper.head = $a(wrapper.body, 'div'); wrapper.head = $a(wrapper.body, 'div');
wrapper.banner_area = $a(wrapper.head, 'div'); wrapper.banner_area = $a(wrapper.head, 'div');
wrapper.toolbar_area = $a(wrapper.head, 'div');
wrapper.setup_wizard_area = $a(wrapper.body, 'div', 'setup-wizard')
wrapper.system_message_area = $a(wrapper.body, 'div', '', wrapper.system_message_area = $a(wrapper.body, 'div', '',
{marginBottom:'16px', padding:'8px', backgroundColor:'#FFD', border:'1px dashed #AA6', display:'none'}) {marginBottom:'16px', padding:'8px', backgroundColor:'#FFD', border:'1px dashed #AA6', display:'none'})
@@ -612,7 +612,6 @@ pscript.home_make_status = function() {
// get values // get values
$c_page('home', 'event_updates', 'get_status_details', user, $c_page('home', 'event_updates', 'get_status_details', user,
function(r,rt) { function(r,rt) {
home_status_bar.render(r.message); home_status_bar.render(r.message);
// system_messages // system_messages
@@ -622,6 +621,11 @@ pscript.home_make_status = function() {
// render online users // render online users
pscript.online_users_obj.render(r.message.online_users); pscript.online_users_obj.render(r.message.online_users);
pscript.online_users = r.message.online_users; pscript.online_users = r.message.online_users;
// setup wizard
if(r.message.setup_status) {
new SetupWizard(r.message.setup_status)
}
} }
); );
} }
@@ -633,7 +637,7 @@ pscript.show_system_message = function(wrapper, msg) {
var txt = $a(wrapper.system_message_area, 'div', '', {lineHeight:'1.6em'}); var txt = $a(wrapper.system_message_area, 'div', '', {lineHeight:'1.6em'});
txt.innerHTML = msg; txt.innerHTML = msg;
var span = $ln($a(wrapper.system_message_area, 'div'), 'Dismiss', var span = $ln($a(wrapper.system_message_area, 'div', '', {textAlign:'right'}), 'Dismiss'.bold(),
function(me) { function(me) {
me.set_working(); me.set_working();
$c_obj('Home Control', 'dismiss_message', '', function(r,rt) { $c_obj('Home Control', 'dismiss_message', '', function(r,rt) {
@@ -729,3 +733,53 @@ pscript.validate_fields = function(d)
if(!flag) alert(msg); if(!flag) alert(msg);
return flag; return flag;
} }
SetupWizard = function(status) {
var me = this;
$.extend(this, {
make: function(status) {
me.status = status;
me.wrapper = page_body.pages['Event Updates'].setup_wizard_area;
$ds(me.wrapper);
me.make_percent(status.percent);
me.make_suggestion(status.ret);
},
make_percent: function(percent) {
$a(me.wrapper, 'div', 'header', {}, 'Your setup is '+percent+'% complete');
var o = $a(me.wrapper, 'div', 'percent-outer');
$a(o, 'div', 'percent-inner', {width:percent + '%'});
},
make_suggestion: function(ret) {
me.suggest_area = $a(me.wrapper, 'div', 'suggestion');
if(me.status.ret.length>1) {
me.prev_next = $a(me.wrapper, 'div', 'prev-next');
// next
me.next = $a(me.prev_next, 'span', 'link_type', null, 'Next Suggestion',
function() { me.show_suggestion(me.cur_sugg+1) });
// prev
me.prev = $a(me.prev_next, 'span', 'link_type', null, 'Previous Suggestion',
function() { me.show_suggestion(me.cur_sugg-1) });
}
if(me.status.ret.length) {
me.show_suggestion(0);
} else {
me.suggest_area.innerHTML = 'Congratulations: '.bold() + 'You are now on your track... Good luck';
}
},
show_suggestion: function(idx) {
me.cur_sugg = idx;
me.suggest_area.innerHTML = 'What you can do next: '.bold() + me.status.ret[idx];
// show hide prev, next
if(me.status.ret.length>1) {
$dh(me.prev); $dh(me.next);
if(idx>0) $ds(me.prev);
if(idx<me.status.ret.length-1) $ds(me.next);
}
}
})
this.make(status);
}

View File

@@ -35,11 +35,51 @@ def get_status_details(arg=None):
if msg_id and msg_id != webnotes.conn.get_global('system_message_id', webnotes.session['user']): if msg_id and msg_id != webnotes.conn.get_global('system_message_id', webnotes.session['user']):
msg = webnotes.conn.get_global('system_message') msg = webnotes.conn.get_global('system_message')
return { ret = {
'user_count': len(online) or 0, 'user_count': len(online) or 0,
'unread_messages': get_unread_messages(), 'unread_messages': get_unread_messages(),
'online_users': online or [], 'online_users': online or [],
'system_message':msg, 'system_message':msg,
'is_trial': webnotes.conn.get_global('is_trial'), 'is_trial': webnotes.conn.get_global('is_trial'),
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0') 'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0'),
'setup_status': get_setup_status()
} }
return ret
def get_setup_status():
"""
Returns the setup status of the current account
"""
if cint(webnotes.conn.get_global('setup_done')):
return ''
percent = 20
ret = []
if not webnotes.conn.get_value('Personalize', None, 'header_html'):
ret.append('<a href="#!Form/Personalize/Personalize">Upload your company banner</a>')
else:
percent += 20
def check_type(doctype, ret, percent):
if not webnotes.conn.sql("select count(*) from tab%s" % doctype)[0][0]:
ret.append('''
<a href="#!Form/%(dt)s/New">
Create a new %(dt)s
</a> or
<a href="#!Import Data/%(dt)s">
Import from a spreadsheet</a>''' % {'dt':doctype})
else:
percent += 20
return ret, percent
ret, percent = check_type('Item', ret, percent)
ret, percent = check_type('Customer', ret, percent)
ret, percent = check_type('Supplier', ret, percent)
if percent==100:
webnotes.conn.set_global('setup_done', '1')
return ''
return {'ret': ret, 'percent': percent}

View File

@@ -26,7 +26,7 @@ class DocType:
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee) emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
emp_nm= emp_nm and emp_nm[0][0] or '' emp_nm= emp_nm and emp_nm[0][0] or ''
self.doc.employee_name = emp_nm self.doc.employee_name = emp_nm
return cstr(emp_nm) return emp_nm
def fetch_kra(self): def fetch_kra(self):
if not self.doc.kra_template: if not self.doc.kra_template:
@@ -88,7 +88,7 @@ class DocType:
if d.score: if d.score:
total = total + flt(d.score_earned) total = total + flt(d.score_earned)
ret={'total_score':flt(total)} ret={'total_score':flt(total)}
return cstr(ret) return ret
def declare_completed(self): def declare_completed(self):
ret={} ret={}

View File

@@ -34,7 +34,7 @@ class DocType:
set(self.doc, 'employee_name', emp_nm and emp_nm[0][0] or '') set(self.doc, 'employee_name', emp_nm and emp_nm[0][0] or '')
ret = { 'employee_name' : emp_nm and emp_nm[0][0] or ''} ret = { 'employee_name' : emp_nm and emp_nm[0][0] or ''}
return str(ret) return ret
#validation for duplicate record #validation for duplicate record
def validate_duplicate_record(self): def validate_duplicate_record(self):

View File

@@ -41,7 +41,7 @@ class DocType:
if self.doc.date_of_birth: if self.doc.date_of_birth:
dt = getdate(self.doc.date_of_birth) + datetime.timedelta(21915) dt = getdate(self.doc.date_of_birth) + datetime.timedelta(21915)
ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')} ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')}
return str(ret) return ret
# check if salary structure exists # check if salary structure exists
#======================================================================================================== #========================================================================================================

View File

@@ -66,7 +66,7 @@ class DocType:
'carry_forwarded_leaves' : prev_bal, 'carry_forwarded_leaves' : prev_bal,
'total_leaves_allocated' : flt(prev_bal) + flt(self.doc.new_leaves_allocated) 'total_leaves_allocated' : flt(prev_bal) + flt(self.doc.new_leaves_allocated)
} }
return str(ret) return ret
# ********************************************** validate ***************************************************** # ********************************************** validate *****************************************************

View File

@@ -52,11 +52,8 @@ cur_frm.cscript.from_date = function(doc, dt, dn) {
// to date // to date
// -------- // --------
cur_frm.cscript.to_date = function(doc, dt, dn) { cur_frm.cscript.to_date = function(doc, dt, dn) {
if(cint(doc.half_day) == 1 && doc.from_date && doc.from_date != doc.to_date){ if(cint(doc.half_day) == 1 && cstr(doc.from_date) && doc.from_date != doc.to_date){
msgprint("To Date should be same as From Date for Half Day leave"); msgprint("To Date should be same as From Date for Half Day leave");
return;
}
if(cint(doc.half_day) == 1){
set_multiple(dt,dn,{to_date:doc.from_date}); set_multiple(dt,dn,{to_date:doc.from_date});
} }
calculate_total_days(doc, dt, dn); calculate_total_days(doc, dt, dn);

View File

@@ -29,7 +29,7 @@ cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year;
// Calculate total if lwp exists // Calculate total if lwp exists
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){ cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
doc.payment_days = cint(doc.total_days_in_month) - cint(doc.leave_without_pay); doc.payment_days = flt(doc.total_days_in_month) - flt(doc.leave_without_pay);
refresh_field('payment_days'); refresh_field('payment_days');
calculate_all(doc, dt, dn); calculate_all(doc, dt, dn);
} }

View File

@@ -101,8 +101,17 @@ class DocType(TransactionBase):
for d in range(m[3]): for d in range(m[3]):
dt = add_days(cstr(m[1]), d) dt = add_days(cstr(m[1]), d)
if dt not in holidays: if dt not in holidays:
if sql("select t1.name from `tabLeave Application` t1, `tabLeave Type` t2 where t2.name = t1.leave_type and ifnull(t2.is_lwp, 0) = 1 and t1.docstatus = 1 and t1.employee = '%s' and '%s' between from_date and to_date"%(self.doc.employee, dt)): leave = sql("""
lwp += 1 select t1.name, t1.half_day
from `tabLeave Application` t1, `tabLeave Type` t2
where t2.name = t1.leave_type
and ifnull(t2.is_lwp, 0) = 1
and t1.docstatus = 1
and t1.employee = '%s'
and '%s' between from_date and to_date
"""%(self.doc.employee, dt))
if leave:
lwp = cint(leave[0][1]) and lwp + 0.5 or lwp + 1
return lwp return lwp
# Check existing # Check existing

View File

@@ -42,7 +42,7 @@ class DocType:
'grade' : cstr(det[0][4]), 'grade' : cstr(det[0][4]),
'backup_employee': cstr(self.doc.employee) 'backup_employee': cstr(self.doc.employee)
} }
return cstr(ret) return ret
# Set Salary structure field values # Set Salary structure field values
@@ -53,7 +53,7 @@ class DocType:
'bank_ac_no' : basic_info and basic_info[0][1] or '', 'bank_ac_no' : basic_info and basic_info[0][1] or '',
'esic_no' : basic_info and basic_info[0][2] or '', 'esic_no' : basic_info and basic_info[0][2] or '',
'pf_no' : basic_info and basic_info[0][3] or ''} 'pf_no' : basic_info and basic_info[0][3] or ''}
return cstr(ret) return ret
# Make earning and deduction table # Make earning and deduction table
#--------------------------------------------------------- #---------------------------------------------------------

View File

@@ -174,4 +174,4 @@ KBAnswer = function(body, data) {
} }
$import(knowledge_base.kb_common); $import(knowledge_base/page/kb_common/kb_common.js);

View File

@@ -203,4 +203,4 @@ KBQuestion = function(parent, det, kb) {
this.make() this.make()
} }
$import(knowledge_base.kb_common); $import(knowledge_base/page/kb_common/kb_common.js);

View File

@@ -15,7 +15,7 @@
'doctype': 'Page', 'doctype': 'Page',
'module': 'Knowledge Base', 'module': 'Knowledge Base',
'name': '__common__', 'name': '__common__',
'page_name': 'Questions', 'page_name': 'questions',
'standard': 'Yes' 'standard': 'Yes'
}, },

View File

View File

@@ -6,7 +6,7 @@ from webnotes import msgprint, errprint
def make_address(): def make_address():
from webnotes.modules.module_manager import reload_doc from webnotes.modules.module_manager import reload_doc
reload_doc('tools','doctype','address') reload_doc('utilities','doctype','address')
from webnotes.model.db_schema import updatedb from webnotes.model.db_schema import updatedb
updatedb('Address') updatedb('Address')
@@ -113,24 +113,24 @@ def delete_unwanted_fields():
def reload_doc_files(): def reload_doc_files():
from webnotes.modules.module_manager import reload_doc from webnotes.modules.module_manager import reload_doc
reload_doc('tools', 'doctype', 'contact') reload_doc('utilities', 'doctype', 'contact')
reload_doc('crm', 'doctype', 'customer') reload_doc('selling', 'doctype', 'customer')
reload_doc('maintenance', 'doctype', 'customer_issue') reload_doc('support', 'doctype', 'customer_issue')
reload_doc('material_management', 'doctype', 'delivery_note') reload_doc('stock', 'doctype', 'delivery_note')
reload_doc('crm', 'doctype', 'enquiry') reload_doc('selling', 'doctype', 'enquiry')
reload_doc('crm', 'doctype', 'installation_note') reload_doc('selling', 'doctype', 'installation_note')
reload_doc('crm', 'doctype', 'lead') reload_doc('selling', 'doctype', 'lead')
reload_doc('maintenance', 'doctype', 'maintenance_schedule') reload_doc('support', 'doctype', 'maintenance_schedule')
reload_doc('maintenance', 'doctype', 'maintenance_visit') reload_doc('support', 'doctype', 'maintenance_visit')
reload_doc('srm', 'doctype', 'purchase_order') reload_doc('buying', 'doctype', 'purchase_order')
reload_doc('material_management', 'doctype', 'purchase_receipt') reload_doc('stock', 'doctype', 'purchase_receipt')
reload_doc('crm', 'doctype', 'quotation') reload_doc('selling', 'doctype', 'quotation')
reload_doc('accounts', 'doctype', 'receivable_voucher') reload_doc('accounts', 'doctype', 'receivable_voucher')
reload_doc('accounts', 'doctype', 'payable_voucher') reload_doc('accounts', 'doctype', 'payable_voucher')
reload_doc('crm', 'doctype', 'sales_order') reload_doc('selling', 'doctype', 'sales_order')
reload_doc('setup', 'doctype', 'sales_partner') reload_doc('setup', 'doctype', 'sales_partner')
reload_doc('material_management', 'doctype', 'serial_no') reload_doc('stock', 'doctype', 'serial_no')
reload_doc('srm', 'doctype', 'supplier') reload_doc('buying', 'doctype', 'supplier')
def reload_mapper_files(): def reload_mapper_files():
from webnotes.modules.module_manager import reload_doc from webnotes.modules.module_manager import reload_doc

View File

@@ -98,6 +98,5 @@ def support_patch():
webnotes.model.delete_doc('DocType','Support Ticket') webnotes.model.delete_doc('DocType','Support Ticket')
reload_doc('setup','doctype','support_email_settings') reload_doc('setup','doctype','support_email_settings')
reload_doc('maintenance','doctype','support_ticket') reload_doc('support','doctype','support_ticket')
reload_doc('maintenance','doctype','support_ticket_response') reload_doc('support','doctype','support_ticket_response')

View File

@@ -1,7 +1,7 @@
# REMEMBER to update this # REMEMBER to update this
# ======================== # ========================
last_patch = 333 last_patch = 339
#------------------------------------------- #-------------------------------------------
@@ -56,8 +56,8 @@ def execute(patch_no):
pass pass
elif patch_no == 40: elif patch_no == 40:
import_from_files(record_list=[['material_management','doctype','item']]) import_from_files(record_list=[['material_management','doctype','item']])
elif patch_no == 42: elif patch_no == 42:
acc = sql("select name, lft, rgt from tabAccount where account_name in ('Incomes', 'Expenses')") acc = sql("select name, lft, rgt from tabAccount where account_name in ('Incomes', 'Expenses')")
for d in acc: for d in acc:
@@ -125,8 +125,8 @@ def execute(patch_no):
elif patch_no == 56: elif patch_no == 56:
sql("delete from `tabModule Def Item` where parent = 'CRM' and doc_type = 'Reports' and doc_name = 'Delivery Note' and display_name = 'Territory, Item Group wise GP'") sql("delete from `tabModule Def Item` where parent = 'CRM' and doc_type = 'Reports' and doc_name = 'Delivery Note' and display_name = 'Territory, Item Group wise GP'")
elif patch_no == 57: elif patch_no == 57:
import_from_files(record_list=[['selling','doctype','sales_order_detail']])
import_from_files(record_list=[['crm','doctype','sales_order_detail']])
elif patch_no == 58: elif patch_no == 58:
# module def patches # module def patches
sql("update `tabModule Def` set module_page = NULL where name not in ('Event Updates', 'Setup', 'My Company')") sql("update `tabModule Def` set module_page = NULL where name not in ('Event Updates', 'Setup', 'My Company')")
@@ -160,8 +160,8 @@ def execute(patch_no):
sql("delete from `tabTDS Category Account` where company not in (select name from tabCompany)") sql("delete from `tabTDS Category Account` where company not in (select name from tabCompany)")
elif patch_no == 62: elif patch_no == 62:
# Import Supplier Quotation # Import Supplier Quotation
import_from_files(record_list=[['srm','doctype','supplier_quotation']]) import_from_files(record_list=[['srm','doctype','supplier_quotation']])
# Adding Status Filter # Adding Status Filter
sql("update tabDocType set search_fields = concat('status,',search_fields) where name IN ('Delivery Note','Leave Transaction')") sql("update tabDocType set search_fields = concat('status,',search_fields) where name IN ('Delivery Note','Leave Transaction')")
# Import Other Charges # Import Other Charges
@@ -169,8 +169,8 @@ def execute(patch_no):
import_from_files(record_list=[['setup','doctype','other_charges']]) import_from_files(record_list=[['setup','doctype','other_charges']])
elif patch_no == 63: elif patch_no == 63:
sql("update `tabDocField` set permlevel = 1 where fieldname in ('return_date', 'return_details') and parent = 'Sales and Purchase Return Wizard'") sql("update `tabDocField` set permlevel = 1 where fieldname in ('return_date', 'return_details') and parent = 'Sales and Purchase Return Wizard'")
import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['material_management', 'doctype', 'sales_and_purchase_return_wizard'], ['material_management', 'doctype', 'stock_entry']]) import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['material_management', 'doctype', 'sales_and_purchase_return_wizard'], ['material_management', 'doctype', 'stock_entry']])
elif patch_no == 64: elif patch_no == 64:
sql("update tabDocField set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where options in ('RFQ','Supplier Quotation')") sql("update tabDocField set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where options in ('RFQ','Supplier Quotation')")
sql("update tabDocType set `read_only` = 1, in_create = 1 where name in ('RFQ','Supplier Quotation')") sql("update tabDocType set `read_only` = 1, in_create = 1 where name in ('RFQ','Supplier Quotation')")
@@ -192,7 +192,7 @@ def execute(patch_no):
sql("delete from `tabModule Def Item` where (display_name = 'Sales Invoice' and parent = 'CRM') or (display_name = 'Purchase Invoice' and parent = 'SRM')") sql("delete from `tabModule Def Item` where (display_name = 'Sales Invoice' and parent = 'CRM') or (display_name = 'Purchase Invoice' and parent = 'SRM')")
elif patch_no == 68: elif patch_no == 68:
from webnotes.modules.import_module import import_from_files from webnotes.modules.import_module import import_from_files
import_from_files(record_list=[['payroll','doctype','employee'],['roles','Role','Employee']]) import_from_files(record_list=[['hr','doctype','employee'],['roles','Role','Employee']])
elif patch_no == 69: elif patch_no == 69:
# delete flds from employee master # delete flds from employee master
p = get_obj('Patch Util') p = get_obj('Patch Util')
@@ -252,7 +252,7 @@ def execute(patch_no):
# import Contact, Employee # import Contact, Employee
from webnotes.modules.import_module import import_from_files from webnotes.modules.import_module import import_from_files
import_from_files(record_list=[['tools','doctype','contact']]) import_from_files(record_list=[['utilities','doctype','contact']])
# remove last_contact_date from Lead # remove last_contact_date from Lead
@@ -294,7 +294,7 @@ def execute(patch_no):
#sal structure patch #sal structure patch
# import # import
from webnotes.modules.import_module import import_from_files from webnotes.modules.import_module import import_from_files
import_from_files(record_list=[['payroll','doctype','salary_structure'], ['payroll','doctype','earning_detail'],['payroll','doctype','deduction_detail']]) import_from_files(record_list=[['hr','doctype','salary_structure'], ['hr','doctype','earning_detail'],['hr','doctype','deduction_detail']])
elif patch_no == 76: elif patch_no == 76:
# property # property
p = get_obj('Patch Util') p = get_obj('Patch Util')
@@ -321,7 +321,7 @@ def execute(patch_no):
# sal slip patch # sal slip patch
# import # import
from webnotes.modules.import_module import import_from_files from webnotes.modules.import_module import import_from_files
import_from_files(record_list=[['payroll','doctype','salary_slip'], ['payroll','doctype','ss_earning_detail'],['payroll','doctype','ss_deduction_detail'], ['mapper', 'DocType Mapper', 'Salary Structure-Salary Slip']]) import_from_files(record_list=[['hr','doctype','salary_slip'], ['hr','doctype','ss_earning_detail'],['hr','doctype','ss_deduction_detail'], ['mapper', 'DocType Mapper', 'Salary Structure-Salary Slip']])
elif patch_no == 78: elif patch_no == 78:
p = get_obj('Patch Util') p = get_obj('Patch Util')
# delete # delete
@@ -351,8 +351,7 @@ def execute(patch_no):
p.add_permission('Salary Slip', 'Employee', 1, read = 1, match = 'owner') p.add_permission('Salary Slip', 'Employee', 1, read = 1, match = 'owner')
elif patch_no == 79: elif patch_no == 79:
# Import Modules # Import Modules
import_from_files(record_list=[['hr','doctype','leave_application'],['hr','doctype','leave_allocation'],['hr','doctype','leave_control_panel'],['hr','doctype','holiday_list'],['hr','doctype','holiday_list_detail'],['hr','Module Def','HR']])
import_from_files(record_list=[['payroll','doctype','leave_application'],['payroll','doctype','leave_allocation'],['payroll','doctype','leave_control_panel'],['payroll','doctype','holiday_list'],['payroll','doctype','holiday_list_detail'],['payroll','Module Def','Payroll']])
elif patch_no == 80: elif patch_no == 80:
# Holiday List # Holiday List
sql("update `tabHoliday List Detail` set description = holiday_name") sql("update `tabHoliday List Detail` set description = holiday_name")
@@ -405,8 +404,7 @@ def execute(patch_no):
elif patch_no == 81: elif patch_no == 81:
# Import Modules # Import Modules
import_from_files(record_list=[['hr','Module Def','HR']])
import_from_files(record_list=[['payroll','Module Def','Payroll']])
elif patch_no == 82: elif patch_no == 82:
sql("update tabDocType set search_fields = 'employee,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'") sql("update tabDocType set search_fields = 'employee,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'")
sql("update tabDocType set search_fields = 'employee,leave_type,from_date,to_date,total_leave_days,fiscal_year' where name = 'Leave Application'") sql("update tabDocType set search_fields = 'employee,leave_type,from_date,to_date,total_leave_days,fiscal_year' where name = 'Leave Application'")
@@ -432,14 +430,13 @@ def execute(patch_no):
sql("update tabDocPerm set `match` = '' where parent = 'Leave Application' and role = 'HR User'") sql("update tabDocPerm set `match` = '' where parent = 'Leave Application' and role = 'HR User'")
elif patch_no == 86: elif patch_no == 86:
# Import Modules # Import Modules
import_from_files(record_list=[['hr','doctype','leave_type']])
import_from_files(record_list=[['payroll','doctype','leave_type']])
elif patch_no == 87: elif patch_no == 87:
sql("update `tabLeave Type` set is_lwp = 1 where name = 'Leave Without Pay'") sql("update `tabLeave Type` set is_lwp = 1 where name = 'Leave Without Pay'")
elif patch_no == 88: elif patch_no == 88:
# Import Modules # Import Modules
import_from_files(record_list=[['hr','doctype','leave_allocation']])
import_from_files(record_list=[['payroll','doctype','leave_allocation']])
elif patch_no == 89: elif patch_no == 89:
sql("delete from `tabModule Def Item` where doc_type = 'Setup Forms' and doc_name in ('Payroll Rule', 'IT Checklist', 'Employee Profile') and parent = 'Payroll'") sql("delete from `tabModule Def Item` where doc_type = 'Setup Forms' and doc_name in ('Payroll Rule', 'IT Checklist', 'Employee Profile') and parent = 'Payroll'")
sql("update `tabDocField` set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where parent = 'Leave Type' and fieldname = 'is_encash'") sql("update `tabDocField` set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where parent = 'Leave Type' and fieldname = 'is_encash'")
@@ -457,10 +454,8 @@ def execute(patch_no):
sql("update `tabTable Mapper Detail` set validation_logic = 'qty > ifnull(billed_qty,0) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail'") sql("update `tabTable Mapper Detail` set validation_logic = 'qty > ifnull(billed_qty,0) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail'")
sql("update `tabField Mapper Detail` set from_field = 'customer' where to_field = 'customer' and parent = 'Sales Order-Receivable Voucher'") sql("update `tabField Mapper Detail` set from_field = 'customer' where to_field = 'customer' and parent = 'Sales Order-Receivable Voucher'")
elif patch_no == 94: elif patch_no == 94:
import_from_files(record_list=[['selling','doctype','sms_center']])
import_from_files(record_list=[['crm','doctype','sms_center']])
elif patch_no == 95: elif patch_no == 95:
import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']]) import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']])
elif patch_no == 96: elif patch_no == 96:
sql("delete from `tabModule Def Item` where doc_type = 'Reports' and display_name = 'Cenvat Credit - Input or Capital Goods' and parent = 'Accounts'") sql("delete from `tabModule Def Item` where doc_type = 'Reports' and display_name = 'Cenvat Credit - Input or Capital Goods' and parent = 'Accounts'")
@@ -490,8 +485,8 @@ def execute(patch_no):
elif patch_no == 103: elif patch_no == 103:
sql("update tabDocField set fieldname = '' where fieldtype = 'HTML'") sql("update tabDocField set fieldname = '' where fieldtype = 'HTML'")
elif patch_no == 104: elif patch_no == 104:
import_from_files(record_list=[['hr','search_criteria','stdsrch_00001'],['hr','search_criteria','stdsrch_00002'],['hr','search_criteria','stdsrch_00003'],['hr','Module Def','HR'],['hr','doctype','leave_application'],['hr','doctype','leave_allocation']])
import_from_files(record_list=[['payroll','search_criteria','stdsrch_00001'],['payroll','search_criteria','stdsrch_00002'],['payroll','search_criteria','stdsrch_00003'],['payroll','Module Def','Payroll'],['payroll','doctype','leave_application'],['payroll','doctype','leave_allocation']])
elif patch_no == 105: elif patch_no == 105:
# Employee Leave Balance # Employee Leave Balance
sql("delete from `tabModule Def Item` where parent = 'Payroll' and doc_type = 'Reports' and display_name IN ('Employeewise Leave Transaction Details','Employeewise Balance Leave Report')") sql("delete from `tabModule Def Item` where parent = 'Payroll' and doc_type = 'Reports' and display_name IN ('Employeewise Leave Transaction Details','Employeewise Balance Leave Report')")
@@ -508,11 +503,11 @@ def execute(patch_no):
elif patch_no == 107: elif patch_no == 107:
sql("delete from `tabDocField` where fieldname = 'fiscal_year' and parent = 'Employee'") sql("delete from `tabDocField` where fieldname = 'fiscal_year' and parent = 'Employee'")
elif patch_no == 108: elif patch_no == 108:
import_from_files(record_list=[['payroll','search_criteria','srch_std_00013']]) import_from_files(record_list=[['hr','search_criteria','srch_std_00013']])
elif patch_no == 109: elif patch_no == 109:
import_from_files(record_list=[['payroll','search_criteria','srch_std_00015']]) import_from_files(record_list=[['hr','search_criteria','srch_std_00015']])
elif patch_no == 110: elif patch_no == 110:
import_from_files(record_list=[['payroll','doctype','salary_structure'], ['payroll', 'doctype', 'salary_slip']]) import_from_files(record_list=[['hr','doctype','salary_structure'], ['hr', 'doctype', 'salary_slip']])
elif patch_no == 111: elif patch_no == 111:
sql("update tabDocType set search_fields = 'transfer_date, from_warehouse, to_warehouse, purpose, remarks' where name = 'Stock Entry'") sql("update tabDocType set search_fields = 'transfer_date, from_warehouse, to_warehouse, purpose, remarks' where name = 'Stock Entry'")
elif patch_no == 112: elif patch_no == 112:
@@ -582,7 +577,7 @@ def execute(patch_no):
p.add_permission('Expense Voucher', 'HR User', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1) p.add_permission('Expense Voucher', 'HR User', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1)
elif patch_no == 128: elif patch_no == 128:
from webnotes.modules import import_module from webnotes.modules import import_module
import_module.import_from_files(record_list=[['crm','doctype','sales_order'], ['crm','doctype','sales_order_detail'], ['material_management','doctype','delivery_note'], ['material_management','doctype','delivery_note_detail']]) import_module.import_from_files(record_list=[['selling','doctype','sales_order'], ['selling','doctype','sales_order_detail'], ['stock','doctype','delivery_note'], ['stock','doctype','delivery_note_detail']])
elif patch_no == 129: elif patch_no == 129:
sql("update `tabTable Mapper Detail` set validation_logic = '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail' and to_table = 'RV Detail'") sql("update `tabTable Mapper Detail` set validation_logic = '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail' and to_table = 'RV Detail'")
sql("update `tabTable Mapper Detail` set validation_logic = '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1' where parent = 'Delivery Note-Receivable Voucher' and from_table = 'Delivery Note Detail' and to_table = 'RV Detail'") sql("update `tabTable Mapper Detail` set validation_logic = '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1' where parent = 'Delivery Note-Receivable Voucher' and from_table = 'Delivery Note Detail' and to_table = 'RV Detail'")
@@ -680,11 +675,11 @@ def execute(patch_no):
sql("delete from tabDocField where label = 'Add / Manage Contacts' and fieldtype = 'Button' and parent = 'Customer'") sql("delete from tabDocField where label = 'Add / Manage Contacts' and fieldtype = 'Button' and parent = 'Customer'")
sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'note' and to_field = 'note'") sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'note' and to_field = 'note'")
elif patch_no == 152: elif patch_no == 152:
import_from_files(record_list=[['crm','doctype','sales_order'], ['material_management','doctype','delivery_note'], ['crm','doctype','customer'], ['crm','doctype','shipping_address'], ['mapper', 'DocType Mapper', 'Sales Order-Delivery Note']]) import_from_files(record_list=[['selling','doctype','sales_order'], ['stock','doctype','delivery_note'], ['selling','doctype','customer'], ['selling','doctype','shipping_address'], ['mapper', 'DocType Mapper', 'Sales Order-Delivery Note']])
elif patch_no == 153: elif patch_no == 153:
sql("delete from `tabDocField` where fieldname = 'sales_person' and parent = 'Customer'") sql("delete from `tabDocField` where fieldname = 'sales_person' and parent = 'Customer'")
elif patch_no == 154: elif patch_no == 154:
import_from_files(record_list=[['material_management','doctype','serial_no'], ['maintenance','doctype','customer_issue']]) import_from_files(record_list=[['stock','doctype','serial_no'], ['support','doctype','customer_issue']])
elif patch_no == 155: elif patch_no == 155:
for d in sql("select name, item_code from `tabSerial No`"): for d in sql("select name, item_code from `tabSerial No`"):
sql("COMMIT") sql("COMMIT")
@@ -707,16 +702,16 @@ def execute(patch_no):
sql("update tabDocType set autoname = 'field:batch_id' where name = 'Batch'") sql("update tabDocType set autoname = 'field:batch_id' where name = 'Batch'")
sql("update tabDocField set no_copy = 1 where parent = 'Batch' and fieldname = 'batch_id'") sql("update tabDocField set no_copy = 1 where parent = 'Batch' and fieldname = 'batch_id'")
elif patch_no == 162: elif patch_no == 162:
import_from_files(record_list=[['crm', 'search_criteria', 'sales_order_pending_items1']]) import_from_files(record_list=[['selling', 'search_criteria', 'sales_order_pending_items1']])
elif patch_no == 163: elif patch_no == 163:
sql("delete from `tabModule Def Item` where display_name = 'Sales Orderwise Pending Packing Item Summary' and parent = 'CRM'") sql("delete from `tabModule Def Item` where display_name = 'Sales Orderwise Pending Packing Item Summary' and parent = 'CRM'")
import_from_files(record_list=[['crm', 'search_criteria', 'sales_orderwise_pending_qty_to_deliver'], ['crm', 'search_criteria', 'sales_orderwise_pending_amount_to_bill'], ['crm', 'search_criteria', 'delivered_items_to_be_install']]) import_from_files(record_list=[['selling', 'search_criteria', 'sales_orderwise_pending_qty_to_deliver'], ['selling', 'search_criteria', 'sales_orderwise_pending_amount_to_bill'], ['selling', 'search_criteria', 'delivered_items_to_be_install']])
elif patch_no == 164: elif patch_no == 164:
import_from_files(record_list=[['srm', 'search_criteria', 'pending_po_items_to_receive'], ['srm', 'search_criteria', 'pending_po_items_to_bill']]) import_from_files(record_list=[['buying', 'search_criteria', 'pending_po_items_to_receive'], ['buying', 'search_criteria', 'pending_po_items_to_bill']])
elif patch_no == 165: elif patch_no == 165:
pass pass
elif patch_no == 166: elif patch_no == 166:
import_from_files(record_list=[['srm', 'doctype', 'purchase_order']]) import_from_files(record_list=[['buying', 'doctype', 'purchase_order']])
elif patch_no == 167: elif patch_no == 167:
if webnotes.conn.get_value('Control Panel', None, 'account_id') not in ['ax0000956', 'ax0001338']: if webnotes.conn.get_value('Control Panel', None, 'account_id') not in ['ax0000956', 'ax0001338']:
sql("delete from tabDocField where parent = 'Purchase Order' and fieldname in ('test_certificate_required', 'estimated_cost', 'transport', 'vendor_reference', 'transportation_required', 'mode_of_dispatch', 'octroi')") sql("delete from tabDocField where parent = 'Purchase Order' and fieldname in ('test_certificate_required', 'estimated_cost', 'transport', 'vendor_reference', 'transportation_required', 'mode_of_dispatch', 'octroi')")
@@ -727,7 +722,7 @@ def execute(patch_no):
elif patch_no == 170: elif patch_no == 170:
import_from_files(record_list=[['mapper', 'DocType Mapper', 'Delivery Note-Receivable Voucher']]) import_from_files(record_list=[['mapper', 'DocType Mapper', 'Delivery Note-Receivable Voucher']])
elif patch_no == 171: elif patch_no == 171:
import_from_files(record_list=[['srm', 'doctype', 'supplier']]) import_from_files(record_list=[['buying', 'doctype', 'supplier']])
elif patch_no == 172: elif patch_no == 172:
import webnotes import webnotes
webnotes.conn.set_global("system_message", """<b>Welcome to the new financial year 2011-2012 !!! </b><br><br> So obvious question in your mind is how to start Entries in the New Fiscal Year in ERPNext? What are the changes you have to make in the system? <br>We have made some guidelines regarding the basic steps you should follow. Please click on link <a href='http://erpnext.blogspot.com/2011/03/how-to-start-entries-in-new-fiscal-year.html'>How to start Entries in the New Fiscal Year in ERPNext?</a>""") webnotes.conn.set_global("system_message", """<b>Welcome to the new financial year 2011-2012 !!! </b><br><br> So obvious question in your mind is how to start Entries in the New Fiscal Year in ERPNext? What are the changes you have to make in the system? <br>We have made some guidelines regarding the basic steps you should follow. Please click on link <a href='http://erpnext.blogspot.com/2011/03/how-to-start-entries-in-new-fiscal-year.html'>How to start Entries in the New Fiscal Year in ERPNext?</a>""")
@@ -749,7 +744,7 @@ def execute(patch_no):
sql("delete from `tabDocField` where label = 'Next Steps' and parent = 'Purchase Order'") sql("delete from `tabDocField` where label = 'Next Steps' and parent = 'Purchase Order'")
sql("update tabDocField set options = 'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order' where parent = 'Stock Entry' and fieldname = 'purpose'") sql("update tabDocField set options = 'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order' where parent = 'Stock Entry' and fieldname = 'purpose'")
elif patch_no == 178: elif patch_no == 178:
import_from_files(record_list = [['payroll', 'doctype', 'salary_slip']]) import_from_files(record_list = [['hr', 'doctype', 'salary_slip']])
elif patch_no == 179: elif patch_no == 179:
from webnotes.utils import get_defaults from webnotes.utils import get_defaults
sl = sql("select name, net_pay from `tabSalary Slip`") sl = sql("select name, net_pay from `tabSalary Slip`")
@@ -792,21 +787,21 @@ def execute(patch_no):
elif patch_no == 187: elif patch_no == 187:
sql("update tabDocType set autoname = '' where name = 'QA Inspection Report'") sql("update tabDocType set autoname = '' where name = 'QA Inspection Report'")
elif patch_no == 188: elif patch_no == 188:
import_from_files(record_list = [['srm', 'doctype', 'qa_inspection_report']]) import_from_files(record_list = [['buying', 'doctype', 'qa_inspection_report']])
elif patch_no == 189: elif patch_no == 189:
sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('entries', 'other_charges') and parent = 'Receivable Voucher'") sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('entries', 'other_charges') and parent = 'Receivable Voucher'")
elif patch_no == 190: elif patch_no == 190:
sql("update tabDocField set permlevel=0 where fieldname = 'fiscal_year' and parent = 'Stock Entry'") sql("update tabDocField set permlevel=0 where fieldname = 'fiscal_year' and parent = 'Stock Entry'")
elif patch_no == 191: elif patch_no == 191:
import_from_files(record_list = [['maintenance', 'doctype', 'customer_issue']]) import_from_files(record_list = [['support', 'doctype', 'customer_issue']])
elif patch_no == 192: elif patch_no == 192:
sql("delete from `tabModule Def Item` where parent = 'Material Management' and doc_name = 'Landed Cost Wizard' and display_name = 'Landed Cost Wizard'") sql("delete from `tabModule Def Item` where parent = 'Material Management' and doc_name = 'Landed Cost Wizard' and display_name = 'Landed Cost Wizard'")
import_from_files(record_list = [['srm', 'Module Def', 'SRM']]) import_from_files(record_list = [['buying', 'Module Def', 'SRM']])
elif patch_no == 193: elif patch_no == 193:
sql("update tabDocField set fieldtype='Button', `trigger`='Client' where parent='Letter Head' and fieldname='set_from_image'") sql("update tabDocField set fieldtype='Button', `trigger`='Client' where parent='Letter Head' and fieldname='set_from_image'")
elif patch_no == 194: elif patch_no == 194:
sql("delete from `tabModule Def Item` where parent = 'SRM' and doc_name = 'Landed Cost Wizard' and display_name = 'Landed Cost Wizard'") sql("delete from `tabModule Def Item` where parent = 'SRM' and doc_name = 'Landed Cost Wizard' and display_name = 'Landed Cost Wizard'")
import_from_files(record_list = [['material_management', 'Module Def', 'Material Management']]) import_from_files(record_list = [['stock', 'Module Def', 'Material Management']])
elif patch_no == 195: elif patch_no == 195:
from webnotes.modules.module_manager import reload_doc from webnotes.modules.module_manager import reload_doc
reload_doc('setup','doctype','manage_account') reload_doc('setup','doctype','manage_account')
@@ -814,7 +809,7 @@ def execute(patch_no):
sql("update `tabModule Def` set module_page = null where name = 'Material Management'") sql("update `tabModule Def` set module_page = null where name = 'Material Management'")
elif patch_no == 197: elif patch_no == 197:
sql("update `tabDocField` set permlevel = 0, in_filter = 1 where fieldname = 'warranty_amc_status' and parent = 'Customer Issue'") sql("update `tabDocField` set permlevel = 0, in_filter = 1 where fieldname = 'warranty_amc_status' and parent = 'Customer Issue'")
import_from_files(record_list = [['maintenance', 'doctype', 'customer_issue']]) import_from_files(record_list = [['support', 'doctype', 'customer_issue']])
elif patch_no == 198: elif patch_no == 198:
sql("delete from `tabDocField` where (label in ('SMS', 'Send SMS') or fieldname in ('message', 'customer_mobile_no')) and parent in ('Quoattion', 'Sales Order', 'Delivery Note', 'Receivable Voucher')") sql("delete from `tabDocField` where (label in ('SMS', 'Send SMS') or fieldname in ('message', 'customer_mobile_no')) and parent in ('Quoattion', 'Sales Order', 'Delivery Note', 'Receivable Voucher')")
sql("delete from `tabDocField` where label in ('SMS', 'Send SMS') and parent = 'Purchase Order'") sql("delete from `tabDocField` where label in ('SMS', 'Send SMS') and parent = 'Purchase Order'")
@@ -842,7 +837,7 @@ def execute(patch_no):
elif patch_no == 205: elif patch_no == 205:
sql("update `tabDocField` set `default` = '' where fieldname = 'naming_series' and parent = 'Installation Note'") sql("update `tabDocField` set `default` = '' where fieldname = 'naming_series' and parent = 'Installation Note'")
elif patch_no == 206: elif patch_no == 206:
reload_doc('crm','doctype','installation_note') reload_doc('selling','doctype','installation_note')
elif patch_no == 207: elif patch_no == 207:
import_from_files(record_list = [['setup', 'doctype', 'company']]) import_from_files(record_list = [['setup', 'doctype', 'company']])
elif patch_no == 208: elif patch_no == 208:
@@ -857,17 +852,17 @@ def execute(patch_no):
# reload company because of disturbed UI # reload company because of disturbed UI
import_from_files(record_list = [['setup', 'doctype', 'company']]) import_from_files(record_list = [['setup', 'doctype', 'company']])
elif patch_no == 213: elif patch_no == 213:
reload_doc('crm','doctype','lead') reload_doc('selling','doctype','lead')
reload_doc('setup','doctype','company') reload_doc('setup','doctype','company')
elif patch_no == 214: elif patch_no == 214:
reload_doc('crm','doctype','sales_order') reload_doc('selling','doctype','sales_order')
elif patch_no == 215: elif patch_no == 215:
# patch for item and image in description # patch for item and image in description
sql("update tabDocField set width = '300px' where fieldname='description'") sql("update tabDocField set width = '300px' where fieldname='description'")
reload_doc('material_management', 'doctype', 'item') reload_doc('stock', 'doctype', 'item')
sql("delete from __DocTypeCache") sql("delete from __DocTypeCache")
elif patch_no == 216: elif patch_no == 216:
import_from_files(record_list = [['material_management', 'doctype', 'serial_no'], ['material_management', 'doctype', 'stock_ledger_entry']]) import_from_files(record_list = [['stock', 'doctype', 'serial_no'], ['stock', 'doctype', 'stock_ledger_entry']])
elif patch_no == 217: elif patch_no == 217:
sql("update tabDocField set options = '\nIn Store\nDelivered\nNot in Use' where fieldname = 'status' and parent = 'Serial No'") sql("update tabDocField set options = '\nIn Store\nDelivered\nNot in Use' where fieldname = 'status' and parent = 'Serial No'")
sql("update tabDocField set no_copy = 1 where fieldname = 'serial_no' and parent = 'Delivery Note Detail'") sql("update tabDocField set no_copy = 1 where fieldname = 'serial_no' and parent = 'Delivery Note Detail'")
@@ -901,13 +896,13 @@ def execute(patch_no):
sql("update tabDocField set hidden = 0 where fieldname in ('pay_to_recd_from', 'total_amount', 'total_amount_in_words') and parent = 'Journal Voucher'") sql("update tabDocField set hidden = 0 where fieldname in ('pay_to_recd_from', 'total_amount', 'total_amount_in_words') and parent = 'Journal Voucher'")
sql("update tabDocField set permlevel = 0 where fieldname = 'pay_to_recd_from' and parent = 'Journal Voucher'") sql("update tabDocField set permlevel = 0 where fieldname = 'pay_to_recd_from' and parent = 'Journal Voucher'")
elif patch_no == 224: elif patch_no == 224:
import_from_files(record_list = [['material_management', 'doctype', 'delivery_note_packing_detail'], ['accounts', 'Print Format', 'Payment Receipt Voucher']]) import_from_files(record_list = [['stock', 'doctype', 'delivery_note_packing_detail'], ['accounts', 'Print Format', 'Payment Receipt Voucher']])
elif patch_no == 225: elif patch_no == 225:
import_from_files(record_list = [['material_management', 'doctype', 'delivery_note_packing_detail']]) import_from_files(record_list = [['stock', 'doctype', 'delivery_note_packing_detail']])
elif patch_no == 226: elif patch_no == 226:
import_from_files(record_list = [['material_management', 'doctype', 'delivery_note_packing_detail']]) import_from_files(record_list = [['stock', 'doctype', 'delivery_note_packing_detail']])
elif patch_no == 227: elif patch_no == 227:
reload_doc('material_management', 'doctype', 'item') reload_doc('stock', 'doctype', 'item')
if webnotes.conn.get_value('Control Panel', None, 'account_id') != 'axjanak2011': if webnotes.conn.get_value('Control Panel', None, 'account_id') != 'axjanak2011':
sql("delete from tabDocField where parent = 'Item' and fieldname='alternate_description' limit 1") sql("delete from tabDocField where parent = 'Item' and fieldname='alternate_description' limit 1")
elif patch_no == 228: elif patch_no == 228:
@@ -920,8 +915,8 @@ def execute(patch_no):
elif patch_no == 229: elif patch_no == 229:
reload_doc('knowledge_base', 'page', 'question_view') reload_doc('knowledge_base', 'page', 'question_view')
elif patch_no == 230: elif patch_no == 230:
reload_doc('srm', 'doctype', 'indent') reload_doc('buying', 'doctype', 'indent')
reload_doc('srm', 'doctype', 'indent_detail') reload_doc('buying', 'doctype', 'indent_detail')
reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Indent') reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Indent')
elif patch_no == 231: elif patch_no == 231:
reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Indent') reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Indent')
@@ -951,12 +946,12 @@ def execute(patch_no):
elif patch_no == 239: elif patch_no == 239:
reload_doc('core', 'doctype', 'docfield') reload_doc('core', 'doctype', 'docfield')
reload_doc('core', 'doctype', 'doctype') reload_doc('core', 'doctype', 'doctype')
from patches.old_patches.feed_patch import set_subjects_and_tagfields
from patches.feed_patch import set_subjects_and_tagfields
set_subjects_and_tagfields() set_subjects_and_tagfields()
elif patch_no == 240: elif patch_no == 240:
# again for sales order (status) # again for sales order (status)
from patches.feed_patch import set_subjects_and_tagfields from patches.old_patches.feed_patch import set_subjects_and_tagfields
set_subjects_and_tagfields() set_subjects_and_tagfields()
elif patch_no == 241: elif patch_no == 241:
sql("update `tabDocField` set fieldtype = 'Text', options = '', in_filter = '' where fieldname = 'serial_no' and parent = 'Stock Ledger Entry'") sql("update `tabDocField` set fieldtype = 'Text', options = '', in_filter = '' where fieldname = 'serial_no' and parent = 'Stock Ledger Entry'")
@@ -975,12 +970,12 @@ def execute(patch_no):
webnotes.conn.set_value('DocType', 'Custom Field', 'module', 'Core') webnotes.conn.set_value('DocType', 'Custom Field', 'module', 'Core')
reload_doc('setup', 'doctype', 'company') reload_doc('setup', 'doctype', 'company')
elif patch_no == 244: elif patch_no == 244:
reload_doc('material_management', 'search_criteria', 'shortage_to_indent') reload_doc('stock', 'search_criteria', 'shortage_to_indent')
elif patch_no == 245: elif patch_no == 245:
from patches.doctype_permission_patch import set_doctype_permissions from patches.old_patches.doctype_permission_patch import set_doctype_permissions
set_doctype_permissions() set_doctype_permissions()
from patches.feed_patch import set_subjects_and_tagfields from patches.old_patches.feed_patch import set_subjects_and_tagfields
set_subjects_and_tagfields() set_subjects_and_tagfields()
elif patch_no == 246: elif patch_no == 246:
webnotes.conn.set_value('DocType','Stock Entry','tag_fields','purpose') webnotes.conn.set_value('DocType','Stock Entry','tag_fields','purpose')
@@ -992,16 +987,16 @@ def execute(patch_no):
elif patch_no == 249: elif patch_no == 249:
sql("update `tabDocPerm` t1, `tabDocType` t2 set t1.role = 'System Manager' where t1.role = 'Administrator' and t1.parent = t2.name and t2.module != 'Core'") sql("update `tabDocPerm` t1, `tabDocType` t2 set t1.role = 'System Manager' where t1.role = 'Administrator' and t1.parent = t2.name and t2.module != 'Core'")
elif patch_no == 250: elif patch_no == 250:
from patches.feed_patch import support_patch from patches.old_patches.feed_patch import support_patch
support_patch() support_patch()
elif patch_no == 251: elif patch_no == 251:
from webnotes.model import db_schema from webnotes.model import db_schema
db_schema.remove_all_foreign_keys() db_schema.remove_all_foreign_keys()
from patches.customer_address import run_patch from patches.old_patches.customer_address import run_patch
run_patch() run_patch()
elif patch_no == 252: elif patch_no == 252:
reload_doc('maintenance','doctype','support_ticket') reload_doc('support','doctype','support_ticket')
reload_doc('maintenance','doctype','support_ticket_response') reload_doc('support','doctype','support_ticket_response')
elif patch_no == 253: elif patch_no == 253:
reload_doc('accounts','doctype','ledger_balance_export') reload_doc('accounts','doctype','ledger_balance_export')
reload_doc('accounts','doctype','ledger_detail') reload_doc('accounts','doctype','ledger_detail')
@@ -1011,21 +1006,21 @@ def execute(patch_no):
updatedb('Ledger Balance Export') updatedb('Ledger Balance Export')
updatedb('Ledger Detail') updatedb('Ledger Detail')
elif patch_no == 254: elif patch_no == 254:
reload_doc('settings', 'doctype', 'sms_settings') reload_doc('setup', 'doctype', 'sms_settings')
reload_doc('settings', 'doctype', 'static_parameter_detail') reload_doc('setup', 'doctype', 'static_parameter_detail')
from webnotes.model.db_schema import updatedb from webnotes.model.db_schema import updatedb
updatedb('SMS Settings') updatedb('SMS Settings')
updatedb('Static Parameter Detail') updatedb('Static Parameter Detail')
elif patch_no == 255: elif patch_no == 255:
from patches.customer_address import run_old_data_sync_patch from patches.old_patches.customer_address import run_old_data_sync_patch
run_old_data_sync_patch() run_old_data_sync_patch()
elif patch_no == 256: elif patch_no == 256:
sql("update `tabLetter Head` set content = replace(content, 'http://46.4.50.84/v170-test/', '')") sql("update `tabLetter Head` set content = replace(content, 'http://46.4.50.84/v170-test/', '')")
sql("update `tabSingles` set value = replace(value, 'http://46.4.50.84/v170-test/', '') where field in ('letter_head', 'client_name') and doctype = 'Control Panel'") sql("update `tabSingles` set value = replace(value, 'http://46.4.50.84/v170-test/', '') where field in ('letter_head', 'client_name') and doctype = 'Control Panel'")
sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170-test/', '')") sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170-test/', '')")
elif patch_no == 257: elif patch_no == 257:
from patches.customer_address import run_old_data_sync_patch from patches.old_patches.customer_address import run_old_data_sync_patch
run_old_data_sync_patch() run_old_data_sync_patch()
elif patch_no == 258: elif patch_no == 258:
sql("update tabDocField set `default`=NULL where fieldname = 'naming_series'") sql("update tabDocField set `default`=NULL where fieldname = 'naming_series'")
@@ -1045,7 +1040,7 @@ def execute(patch_no):
elif patch_no == 261: elif patch_no == 261:
sql("update `tabPrint Format` set html = replace(html, 'customer_address', 'address_display')") sql("update `tabPrint Format` set html = replace(html, 'customer_address', 'address_display')")
elif patch_no == 262: elif patch_no == 262:
from patches.customer_address import sync_lead_phone from patches.old_patches.customer_address import sync_lead_phone
sync_lead_phone() sync_lead_phone()
elif patch_no == 263: elif patch_no == 263:
ol = ['','Open','To Reply','Waiting for Customer','Hold','Closed'] ol = ['','Open','To Reply','Waiting for Customer','Hold','Closed']
@@ -1074,8 +1069,8 @@ def execute(patch_no):
except: pass except: pass
elif patch_no == 271: elif patch_no == 271:
# tags patch # tags patch
reload_doc('crm','doctype','sales_order') reload_doc('selling','doctype','sales_order')
reload_doc('material_management','doctype','delivery_note') reload_doc('stock','doctype','delivery_note')
sql("delete from tabDocField where fieldname='per_amt_billed' and parent in ('Sales Order', 'Delivery Note')") sql("delete from tabDocField where fieldname='per_amt_billed' and parent in ('Sales Order', 'Delivery Note')")
sql("""update `tabSales Order` set delivery_status = if(ifnull(per_delivered,0) < 0.001, 'Not Delivered', sql("""update `tabSales Order` set delivery_status = if(ifnull(per_delivered,0) < 0.001, 'Not Delivered',
@@ -1096,7 +1091,7 @@ def execute(patch_no):
sn = sql("select name from `tabSearch Criteria` where criteria_name = 'Sales Personwise Transaction Summary'") sn = sql("select name from `tabSearch Criteria` where criteria_name = 'Sales Personwise Transaction Summary'")
for d in sn: for d in sn:
delete_doc('Search Criteria', d[0]) delete_doc('Search Criteria', d[0])
reload_doc('crm', 'search_criteria', 'sales_personwise_transaction_summary') reload_doc('selling', 'search_criteria', 'sales_personwise_transaction_summary')
elif patch_no == 277: elif patch_no == 277:
webnotes.model.delete_doc('DocType','HomePage Settings') webnotes.model.delete_doc('DocType','HomePage Settings')
webnotes.model.delete_doc('DocType','Badge Settings') webnotes.model.delete_doc('DocType','Badge Settings')
@@ -1140,7 +1135,7 @@ def execute(patch_no):
for d in rec: for d in rec:
sql("update `tab%s` set docstatus = %s where name = '%s'" % (d[0], d[2]=='No' and 1 or 2, d[1])) sql("update `tab%s` set docstatus = %s where name = '%s'" % (d[0], d[2]=='No' and 1 or 2, d[1]))
elif patch_no == 284: elif patch_no == 284:
reload_doc('maintenance', 'doctype', 'support_ticket') reload_doc('support', 'doctype', 'support_ticket')
sql("update `tabDocField` set in_filter = 1 where fieldname in ('raised_by', 'subject') and parent = 'Support Ticket'") sql("update `tabDocField` set in_filter = 1 where fieldname in ('raised_by', 'subject') and parent = 'Support Ticket'")
elif patch_no == 286: elif patch_no == 286:
reload_doc('accounts', 'search_criteria', 'itemwise_sales_register') reload_doc('accounts', 'search_criteria', 'itemwise_sales_register')
@@ -1161,7 +1156,7 @@ def execute(patch_no):
md.module_label = 'Home' md.module_label = 'Home'
md.save(1) md.save(1)
elif patch_no == 291: elif patch_no == 291:
reload_doc('tools','doctype','rename_tool') reload_doc('utilities','doctype','rename_tool')
elif patch_no == 292: elif patch_no == 292:
reload_doc('accounts', 'search_criteria', 'trial_balance') reload_doc('accounts', 'search_criteria', 'trial_balance')
elif patch_no == 293: elif patch_no == 293:
@@ -1178,14 +1173,14 @@ def execute(patch_no):
sql("update `tabDocField` set options = 'Billed\nNot Billed\nPartly Billed\nClosed' where parent = 'Sales Order' and fieldname = 'billing_status'") sql("update `tabDocField` set options = 'Billed\nNot Billed\nPartly Billed\nClosed' where parent = 'Sales Order' and fieldname = 'billing_status'")
elif patch_no == 296: elif patch_no == 296:
sql("delete from tabDocField where parent='Support Ticket' and fieldname='contact_no'") sql("delete from tabDocField where parent='Support Ticket' and fieldname='contact_no'")
reload_doc('maintenance', 'doctype', 'support_ticket') reload_doc('support', 'doctype', 'support_ticket')
elif patch_no == 297: elif patch_no == 297:
reload_doc('payroll', 'doctype', 'employee') reload_doc('hr', 'doctype', 'employee')
reload_doc('payroll', 'doctype', 'attendance') reload_doc('hr', 'doctype', 'attendance')
reload_doc('payroll', 'doctype', 'expense_voucher') reload_doc('hr', 'doctype', 'expense_voucher')
reload_doc('payroll', 'doctype', 'appraisal') reload_doc('hr', 'doctype', 'appraisal')
reload_doc('payroll', 'doctype', 'salary_structure') reload_doc('hr', 'doctype', 'salary_structure')
reload_doc('payroll', 'doctype', 'salary_slip') reload_doc('hr', 'doctype', 'salary_slip')
elif patch_no == 298: elif patch_no == 298:
sql("update `tabDocField` set options = 'link:Company' where parent = 'Attendance' and fieldname = 'company'") sql("update `tabDocField` set options = 'link:Company' where parent = 'Attendance' and fieldname = 'company'")
sql("update `tabDocField` set options = 'link:Company' where parent = 'Expense Voucher' and fieldname = 'company'") sql("update `tabDocField` set options = 'link:Company' where parent = 'Expense Voucher' and fieldname = 'company'")
@@ -1212,7 +1207,7 @@ def execute(patch_no):
sql("update `tabDocField` set options = 'link:Item' where parent = 'Raw Materials Supplied' and fieldname = 'po_item'") sql("update `tabDocField` set options = 'link:Item' where parent = 'Raw Materials Supplied' and fieldname = 'po_item'")
sql("update `tabDocField` set options = 'Sales Order' where parent = 'Indent Detail' and fieldname = 'sales_order_no'") sql("update `tabDocField` set options = 'Sales Order' where parent = 'Indent Detail' and fieldname = 'sales_order_no'")
sql("update `tabDocField` set options = 'link:Company', fieldtype = 'Select' where parent = 'Stock Ledger Entry' and fieldname = 'company'") sql("update `tabDocField` set options = 'link:Company', fieldtype = 'Select' where parent = 'Stock Ledger Entry' and fieldname = 'company'")
reload_doc('tools', 'doctype', 'rename_tool') reload_doc('utilities', 'doctype', 'rename_tool')
elif patch_no == 307: elif patch_no == 307:
sql("delete from `tabDocField` where parent = 'company' and label = 'Trash Company' and fieldtype = 'Button'") sql("delete from `tabDocField` where parent = 'company' and label = 'Trash Company' and fieldtype = 'Button'")
reload_doc('setup', 'doctype', 'company') reload_doc('setup', 'doctype', 'company')
@@ -1335,7 +1330,7 @@ def execute(patch_no):
reload_doc('accounts', 'search_criteria', 'lease_agreement_list') reload_doc('accounts', 'search_criteria', 'lease_agreement_list')
reload_doc('accounts', 'search_criteria', 'lease_monthly_future_installment_inflows') reload_doc('accounts', 'search_criteria', 'lease_monthly_future_installment_inflows')
reload_doc('accounts', 'search_criteria', 'lease_overdue_age_wise') reload_doc('accounts', 'search_criteria', 'lease_overdue_age_wise')
reload_doc('accounts', 'search_criteria', 'lease_overdue_list') reload_doc('accounts', 'search_criteria', 'lease_over_due_list')
reload_doc('accounts', 'search_criteria', 'lease_receipts_client_wise') reload_doc('accounts', 'search_criteria', 'lease_receipts_client_wise')
reload_doc('accounts', 'search_criteria', 'lease_receipt_summary_year_to_date') reload_doc('accounts', 'search_criteria', 'lease_receipt_summary_year_to_date')
reload_doc('accounts', 'search_criteria', 'lease_yearly_future_installment_inflows') reload_doc('accounts', 'search_criteria', 'lease_yearly_future_installment_inflows')
@@ -1349,4 +1344,66 @@ def execute(patch_no):
elif patch_no == 332: elif patch_no == 332:
sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'") sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'")
elif patch_no == 333: elif patch_no == 333:
sql("update `tabDocPerm` set `create` =1 where role = 'Accounts Manager' and parent = 'Lease Agreement'")
p = get_obj('Patch Util')
p.add_permission('DocType Mapper', 'System Manager', 0, read = 1, write=1, create=1)
p.add_permission('Role', 'System Manager', 0, read = 1, write=1, create=1)
p.add_permission('Print Format', 'System Manager', 0, read = 1, write=1, create=1)
elif patch_no == 334:
reload_doc('knowledge_base', 'doctype', 'answer')
elif patch_no == 335:
for dt in ['Account', 'Cost Center', 'Territory', 'Item Group', 'Customer Group']:
sql("update `tabDocField` set fieldtype = 'Link', options = %s where fieldname = 'old_parent' and parent = %s", (dt, dt))
elif patch_no == 336:
reload_doc('server_tools','page','billing')
elif patch_no == 337:
item_list = webnotes.conn.sql("""SELECT name, description_html
FROM tabItem""")
if item_list:
for item, html in item_list:
if html and "getfile" in html and "acx" in html:
ac_id = webnotes.conn.sql("""SELECT value FROM `tabSingles` WHERE doctype='Control Panel' AND field='account_id'""")
sp_acx = html.split("acx=")
l_acx = len(sp_acx)
if l_acx > 1:
for i in range(l_acx-1):
sp_quot = sp_acx[i+1].split('"')
if len(sp_quot) > 1: sp_quot[0] = str(ac_id[0][0])
sp_acx[i+1] = '"'.join(sp_quot)
html = "acx=".join(sp_acx)
webnotes.conn.sql("""UPDATE tabItem SET description_html=%s WHERE name=%s""", (html, item))
elif patch_no == 338:
# Patch for billing status based on amount
# reload so and dn
reload_doc('selling','doctype','sales_order')
reload_doc('stock','doctype','delivery_note')
# delete billed_qty field
sql("delete from `tabDocField` where fieldname = 'billed_qty' and parent in ('Sales Order Detail', 'Delivery Note Detail')")
# update billed amt in item table in so and dn
sql(""" update `tabSales Order Detail` so
set billed_amt = (select sum(amount) from `tabRV Detail` where `so_detail`= so.name and docstatus=1 and parent not like 'old%%'), modified = now()""")
sql(""" update `tabDelivery Note Detail` dn
set billed_amt = (select sum(amount) from `tabRV Detail` where `dn_detail`= dn.name and docstatus=1 and parent not like 'old%%'), modified = now()""")
# calculate % billed based on item table
sql(""" update `tabSales Order` so
set per_billed = (select sum(if(amount > ifnull(billed_amt, 0), billed_amt, amount))/sum(amount)*100 from `tabSales Order Detail` where parent = so.name), modified = now()""")
sql(""" update `tabDelivery Note` dn
set per_billed = (select sum(if(amount > ifnull(billed_amt, 0), billed_amt, amount))/sum(amount)*100 from `tabDelivery Note Detail` where parent = dn.name), modified = now()""")
# update billing status based on % billed
sql("""update `tabSales Order` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed',
if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
sql("""update `tabDelivery Note` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed',
if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
# update name of questions page
sql("update tabPage set name='questions' where name='Questions'")
sql("update tabPage set name='question-view' where name='Question View'")
elif patch_no == 339
reload_doc('production','doctype','bill_of_materials') reload_doc('production','doctype','bill_of_materials')

View File

@@ -36,7 +36,7 @@ class DocType:
ret={ ret={
'description' : item and item[0]['description'] or '' 'description' : item and item[0]['description'] or ''
} }
return cstr(ret) return ret
def get_workstation_details(self,workstation): def get_workstation_details(self,workstation):
ws = sql("select hour_rate, capacity from `tabWorkstation` where name = %s",workstation , as_dict = 1) ws = sql("select hour_rate, capacity from `tabWorkstation` where name = %s",workstation , as_dict = 1)
@@ -44,7 +44,7 @@ class DocType:
'hour_rate' : ws and flt(ws[0]['hour_rate']) or '', 'hour_rate' : ws and flt(ws[0]['hour_rate']) or '',
'workstation_capacity' : ws and flt(ws[0]['capacity']) or '' 'workstation_capacity' : ws and flt(ws[0]['capacity']) or ''
} }
return cstr(ret) return ret
def get_bom_material_detail(self, arg): def get_bom_material_detail(self, arg):
arg = eval(arg) arg = eval(arg)
@@ -106,7 +106,7 @@ class DocType:
'standard_rate' : 0 'standard_rate' : 0
} }
ret_item.update(ret_bom_rates) ret_item.update(ret_bom_rates)
return cstr(ret_item) return ret_item
def set_as_default_bom(self): def set_as_default_bom(self):
# set Is Default as 1 # set Is Default as 1

View File

@@ -32,7 +32,7 @@ class DocType:
'stock_uom' : item and item[0]['stock_uom'], 'stock_uom' : item and item[0]['stock_uom'],
'bom_no' : item and item[0]['default_bom'] 'bom_no' : item and item[0]['default_bom']
} }
return cstr(ret) return ret
else: else:
msgprint("Item %s does not exist in system." %(args['item_code'])) msgprint("Item %s does not exist in system." %(args['item_code']))
raise Exception raise Exception

View File

@@ -25,7 +25,7 @@ class DocType:
def update_bom_operation(self): def update_bom_operation(self):
bom_list = sql(" select DISTINCT parent from `tabBOM Operation` where workstation = '%s'" % self.doc.name) bom_list = sql(" select DISTINCT parent from `tabBOM Operation` where workstation = '%s'" % self.doc.name)
for bom_no in bom_list: for bom_no in bom_list:
sql("update `tabBOM Operation` set hour_rate = '%s' where parent = '%s' and workstation = '%s'"%( self.doc.hour_rate, bom_no, self.doc.name)) sql("update `tabBOM Operation` set hour_rate = '%s' where parent = '%s' and workstation = '%s'"%( self.doc.hour_rate, bom_no[0], self.doc.name))
def on_update(self): def on_update(self):
set(self.doc, 'overhead', flt(self.doc.hour_rate_electricity) + flt(self.doc.hour_rate_consumable) + flt(self.doc.hour_rate_rent)) set(self.doc, 'overhead', flt(self.doc.hour_rate_electricity) + flt(self.doc.hour_rate_consumable) + flt(self.doc.hour_rate_rent))

View File

@@ -38,7 +38,7 @@ class DocType:
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or '' ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or '' ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
ret['email_id'] = contact_det and contact_det[0]['email_id'] or '' ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
return cstr(ret) return ret
else: else:
msgprint("Customer : %s does not exist in system." % (self.doc.customer)) msgprint("Customer : %s does not exist in system." % (self.doc.customer))
raise Exception raise Exception
@@ -65,7 +65,7 @@ class DocType:
#if pft > 0: #if pft > 0:
per_pft = (flt(pft) / flt(self.doc.project_value)) * 100 per_pft = (flt(pft) / flt(self.doc.project_value)) * 100
ret = {'gross_margin_value': pft, 'per_gross_margin': per_pft} ret = {'gross_margin_value': pft, 'per_gross_margin': per_pft}
return cstr(ret) return ret
# validate # validate
#================================================ #================================================

View File

@@ -22,18 +22,18 @@ class DocType:
cust = sql("select customer, customer_name from `tabProject` where name = %s", self.doc.project) cust = sql("select customer, customer_name from `tabProject` where name = %s", self.doc.project)
if cust: if cust:
ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''} ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
return cstr(ret) return ret
def get_customer_details(self): def get_customer_details(self):
cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer) cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
if cust: if cust:
ret = {'customer_name': cust and cust[0][0] or ''} ret = {'customer_name': cust and cust[0][0] or ''}
return cstr(ret) return ret
def get_allocated_to_name(self): def get_allocated_to_name(self):
as_em = sql("select first_name, last_name from `tabProfile` where name=%s",self.doc.allocated_to) as_em = sql("select first_name, last_name from `tabProfile` where name=%s",self.doc.allocated_to)
ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''} ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''}
return cstr(ret) return ret
# validate # validate
#-------------------------------------------- #--------------------------------------------

View File

@@ -32,7 +32,7 @@ class DocType:
tsk = sql("select name, project, customer, customer_name from `tabTicket` where subject = %s", task_sub) tsk = sql("select name, project, customer, customer_name from `tabTicket` where subject = %s", task_sub)
if tsk: if tsk:
ret = {'task_id': tsk and tsk[0][0] or '', 'project_name': tsk and tsk[0][1] or '', 'customer_name': tsk and tsk[0][3] or ''} ret = {'task_id': tsk and tsk[0][0] or '', 'project_name': tsk and tsk[0][1] or '', 'customer_name': tsk and tsk[0][3] or ''}
return cstr(ret) return ret
def validate(self): def validate(self):
if getdate(self.doc.timesheet_date) > getdate(nowdate()): if getdate(self.doc.timesheet_date) > getdate(nowdate()):

View File

@@ -50,7 +50,7 @@ class DocType(TransactionBase):
ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or '' ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
ret['email_id'] = contact_det and contact_det[0]['email_id'] or '' ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
return cstr(ret) return ret
else: else:
msgprint("Customer : %s does not exist in system." % (name)) msgprint("Customer : %s does not exist in system." % (name))
raise Exception raise Exception
@@ -64,7 +64,7 @@ class DocType(TransactionBase):
'contact_no' : contact and contact[0]['contact_no'] or '', 'contact_no' : contact and contact[0]['contact_no'] or '',
'email_id' : contact and contact[0]['email_id'] or '' 'email_id' : contact and contact[0]['email_id'] or ''
} }
return str(ret) return ret
# ==================================================================================================================== # ====================================================================================================================
def on_update(self): def on_update(self):
@@ -184,7 +184,7 @@ class DocType(TransactionBase):
else: else:
set(self.doc, 'status', 'Enquiry Lost') set(self.doc, 'status', 'Enquiry Lost')
set(self.doc, 'order_lost_reason', arg) set(self.doc, 'order_lost_reason', arg)
return cstr('true') return 'true'
# ==================================================================================================================== # ====================================================================================================================
def update_follow_up(self): def update_follow_up(self):

View File

@@ -30,19 +30,6 @@ class DocType(TransactionBase):
def autoname(self): def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####') self.doc.name = make_autoname(self.doc.naming_series+'.#####')
#fetch customer details
#=================================
#def get_customer_details(self):
# det = sql("select t1.customer_name, t1.address,t1.territory,t2.contact_name from `tabCustomer` t1, `tabContact` t2 where t1.name = '%s' and t1.name=t2.customer and t2.is_primary_contact = 'Yes'"%self.doc.customer, as_dict=1)
# ret = {
# 'customer_name': det and det[0]['customer_name'] or '',
# 'address' : det and det[0]['address'] or '',
# 'territory': det and det[0]['territory'] or '',
# 'contact_person' : det and det[0]['contact_name'] or ''
# }
# return str(ret)
#fetch delivery note details #fetch delivery note details
#==================================== #====================================

View File

@@ -51,7 +51,7 @@ class DocType:
'description': it and it[0][3] or '', 'description': it and it[0][3] or '',
'uom' : it and it[0][4] or '' 'uom' : it and it[0][4] or ''
} }
return cstr(ret) return ret
def validate(self): def validate(self):
import string import string

View File

@@ -45,17 +45,12 @@ class DocType(TransactionBase):
self.get_adj_percent() self.get_adj_percent()
return cstr(self.doc.quotation_to) return self.doc.quotation_to
# Get Customer Details
# --------------------
#def get_customer_details(self):
# return cstr(get_obj('Sales Common').get_customer_details(self))
# Get contact person details based on customer selected # Get contact person details based on customer selected
# ------------------------------------------------------ # ------------------------------------------------------
def get_contact_details(self): def get_contact_details(self):
return cstr(get_obj('Sales Common').get_contact_details(self,0)) return get_obj('Sales Common').get_contact_details(self,0)
# Clear Quotation Details # Clear Quotation Details
# ----------------------- # -----------------------
@@ -111,7 +106,7 @@ class DocType(TransactionBase):
'contact_mobile' : details and details[0]['mobile_no'] or '-', 'contact_mobile' : details and details[0]['mobile_no'] or '-',
'contact_email' : details and details[0]['email_id'] or '-' 'contact_email' : details and details[0]['email_id'] or '-'
} }
return cstr(ret) return ret
# GET TERMS AND CONDITIONS # GET TERMS AND CONDITIONS
@@ -295,7 +290,7 @@ class DocType(TransactionBase):
set(self.doc, 'status', 'Order Lost') set(self.doc, 'status', 'Order Lost')
set(self.doc, 'order_lost_reason', arg) set(self.doc, 'order_lost_reason', arg)
self.update_enquiry('order lost') self.update_enquiry('order lost')
return cstr('true') return 'true'
#check if value entered in item table #check if value entered in item table
#-------------------------------------- #--------------------------------------

View File

@@ -143,7 +143,8 @@ class DocType(TransactionBase):
if obj.doc.doctype == 'Receivable Voucher': if obj.doc.doctype == 'Receivable Voucher':
return ret return ret
return str(ret)
return ret
# ***************** Get Ref rate as entered in Item Master ******************** # ***************** Get Ref rate as entered in Item Master ********************
def get_ref_rate(self, item_code, price_list_name, currency): def get_ref_rate(self, item_code, price_list_name, currency):
@@ -161,7 +162,6 @@ class DocType(TransactionBase):
d.base_ref_rate = flt(ref_rate) * flt(obj.doc.conversion_rate) d.base_ref_rate = flt(ref_rate) * flt(obj.doc.conversion_rate)
d.export_rate = flt(ref_rate) d.export_rate = flt(ref_rate)
# Load Default Taxes # Load Default Taxes
# ==================== # ====================
def load_default_taxes(self, obj): def load_default_taxes(self, obj):
@@ -203,7 +203,7 @@ class DocType(TransactionBase):
ret = { ret = {
'item_tax_rate' : tax and str(t) or '' 'item_tax_rate' : tax and str(t) or ''
} }
return str(ret) return ret
# Get Serial No Details # Get Serial No Details
# ========================================================================== # ==========================================================================
@@ -220,7 +220,7 @@ class DocType(TransactionBase):
'description' : item and item[0]['description'] or '', 'description' : item and item[0]['description'] or '',
'item_tax_rate' : str(t) 'item_tax_rate' : str(t)
} }
return str(ret) return ret
# Get Commission rate # Get Commission rate
# ======================================================================= # =======================================================================
@@ -233,7 +233,7 @@ class DocType(TransactionBase):
'commission_rate' : comm_rate and flt(comm_rate[0]['commission_rate']) or 0, 'commission_rate' : comm_rate and flt(comm_rate[0]['commission_rate']) or 0,
'total_commission' : flt(total_comm) 'total_commission' : flt(total_comm)
} }
return str(ret) return ret
else: else:
msgprint("Business Associate : %s does not exist in the system." % (sales_partner)) msgprint("Business Associate : %s does not exist in the system." % (sales_partner))
raise Exception raise Exception
@@ -287,7 +287,7 @@ class DocType(TransactionBase):
ret = { ret = {
'rate' : rate and flt(rate[0]['tax_rate']) or 0 'rate' : rate and flt(rate[0]['tax_rate']) or 0
} }
return cstr(ret) return ret
# Make Packing List from Sales BOM # Make Packing List from Sales BOM
@@ -324,11 +324,33 @@ class DocType(TransactionBase):
if self.has_sales_bom(d.item_code): if self.has_sales_bom(d.item_code):
for i in self.get_sales_bom_items(d.item_code): for i in self.get_sales_bom_items(d.item_code):
il.append([warehouse, i[0], flt(flt(i[1])* qty), reserved_qty, i[2], d.batch_no, d.serial_no]) il.append([warehouse, i[0], flt(flt(i[1])* qty), flt(flt(i[1])*reserved_qty), i[2], d.batch_no, d.serial_no])
else: else:
il.append([warehouse, d.item_code, qty, reserved_qty, d.stock_uom, d.batch_no, d.serial_no]) il.append([warehouse, d.item_code, qty, reserved_qty, d.stock_uom, d.batch_no, d.serial_no])
return il return il
# ---------------------------------------------------------------------------------------------
# get qty, amount already billed or delivered against curr line item for current doctype
# For Eg: SO-RV get total qty, amount from SO and also total qty, amount against that SO in RV
# ---------------------------------------------------------------------------------------------
def get_curr_and_ref_doc_details(self, curr_doctype, ref_tab_fname, ref_tab_dn, ref_doc_tname, curr_parent_name, curr_parent_doctype):
# Get total qty, amt of current doctype (eg RV) except for qty, amt of this transaction
if curr_parent_doctype == 'Installation Note':
curr_det = sql("select sum(qty) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
qty, amt = curr_det and flt(curr_det[0][0]) or 0, 0
else:
curr_det = sql("select sum(qty), sum(amount) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
qty, amt = curr_det and flt(curr_det[0][0]) or 0, curr_det and flt(curr_det[0][1]) or 0
# get total qty of ref doctype
ref_det = sql("select qty, amount from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn))
max_qty, max_amt = ref_det and flt(ref_det[0][0]) or 0, ref_det and flt(ref_det[0][1]) or 0
return qty, max_qty, amt, max_amt
# ----------------------- # -----------------------
# add packing list items # add packing list items
@@ -458,26 +480,6 @@ class DocType(TransactionBase):
def update_prevdoc_detail(self, is_submit, obj): def update_prevdoc_detail(self, is_submit, obj):
StatusUpdater(obj, is_submit).update() StatusUpdater(obj, is_submit).update()
# ---------------------------------------------------------------------------------------------
# get qty, amount already billed or delivered against curr line item for current doctype
# For Eg: SO-RV get total qty, amount from SO and also total qty, amount against that SO in RV
# ---------------------------------------------------------------------------------------------
def get_curr_and_ref_doc_details(self, curr_doctype, ref_tab_fname, ref_tab_dn, ref_doc_tname, curr_parent_name, curr_parent_doctype):
# Get total qty, amt of current doctype (eg RV) except for qty, amt of this transaction
if curr_parent_doctype == 'Installation Note':
curr_det = sql("select sum(qty) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
qty, amt = curr_det and flt(curr_det[0][0]) or 0, 0
else:
curr_det = sql("select sum(qty), sum(amount) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
qty, amt = curr_det and flt(curr_det[0][0]) or 0, curr_det and flt(curr_det[0][1]) or 0
# get total qty of ref doctype
ref_det = sql("select qty, amount from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn))
max_qty, max_amt = ref_det and flt(ref_det[0][0]) or 0, ref_det and flt(ref_det[0][1]) or 0
return qty, max_qty, amt, max_amt
@@ -496,7 +498,7 @@ class StatusUpdater:
- Validate over delivery - Validate over delivery
From Receivable Voucher From Receivable Voucher
- Update Billed Qty - Update Billed Amt
- Update Percent - Update Percent
- Validate over billing - Validate over billing
@@ -524,23 +526,33 @@ class StatusUpdater:
self.validate_qty({ self.validate_qty({
'source_dt' :'Delivery Note Detail', 'source_dt' :'Delivery Note Detail',
'compare_field' :'delivered_qty', 'compare_field' :'delivered_qty',
'compare_ref_field' :'qty',
'target_dt' :'Sales Order Detail', 'target_dt' :'Sales Order Detail',
'join_field' :'prevdoc_detail_docname' 'join_field' :'prevdoc_detail_docname'
}) })
elif self.obj.doc.doctype=='Receivable Voucher': elif self.obj.doc.doctype=='Receivable Voucher':
self.validate_qty({ self.validate_qty({
'source_dt' :'RV Detail', 'source_dt' :'RV Detail',
'compare_field' :'billed_qty', 'compare_field' :'billed_amt',
'compare_ref_field' :'amount',
'target_dt' :'Sales Order Detail', 'target_dt' :'Sales Order Detail',
'join_field' :'so_detail' 'join_field' :'so_detail'
}) })
self.validate_qty({
'source_dt' :'RV Detail',
'compare_field' :'billed_amt',
'compare_ref_field' :'amount',
'target_dt' :'Delivery Note Detail',
'join_field' :'dn_detail'
}, no_tolerance =1)
elif self.obj.doc.doctype=='Installation Note': elif self.obj.doc.doctype=='Installation Note':
self.validate_qty({ self.validate_qty({
'source_dt' :'Installation Item Details', 'source_dt' :'Installation Item Details',
'compare_field' :'installed_qty', 'compare_field' :'installed_qty',
'compare_ref_field' :'qty',
'target_dt' :'Delivery Note Detail', 'target_dt' :'Delivery Note Detail',
'join_field' :'dn_detail' 'join_field' :'dn_detail'
}, no_tolerance =1); }, no_tolerance =1)
def get_tolerance_for(self, item_code): def get_tolerance_for(self, item_code):
@@ -567,22 +579,22 @@ class StatusUpdater:
# check if overflow is within tolerance # check if overflow is within tolerance
tolerance = self.get_tolerance_for(item['item_code']) tolerance = self.get_tolerance_for(item['item_code'])
overflow_percent = ((item[args['compare_field']] - item['qty']) / item['qty'] * 100) overflow_percent = ((item[args['compare_field']] - item[args['compare_ref_field']]) / item[args['compare_ref_field']] * 100)
if overflow_percent - tolerance > 0.0001: if overflow_percent - tolerance > 0.0001:
item['max_allowed'] = flt(item['qty'] * (100+tolerance)/100) item['max_allowed'] = flt(item[args['compare_ref_field']] * (100+tolerance)/100)
item['reduce_by'] = item[args['compare_field']] - item['max_allowed'] item['reduce_by'] = item[args['compare_field']] - item['max_allowed']
msgprint(""" msgprint("""
Row #%(idx)s: Max qty allowed for <b>Item %(item_code)s</b> against <b>%(parenttype)s %(parent)s</b> is <b>%(max_allowed)s</b>. Row #%(idx)s: Max %(compare_ref_field)s allowed for <b>Item %(item_code)s</b> against <b>%(parenttype)s %(parent)s</b> is <b>%(max_allowed)s</b>.
If you want to increase your overflow tolerance, please increase tolerance %% in Global Defaults or Item master. If you want to increase your overflow tolerance, please increase tolerance %% in Global Defaults or Item master.
Or, you must reduce the qty by %(reduce_by)s""" % item, raise_exception=1) Or, you must reduce the %(compare_ref_field)s by %(reduce_by)s""" % item, raise_exception=1)
def validate_qty(self, args, no_tolerance=None): def validate_qty(self, args, no_tolerance=None):
""" """
Updates qty at row level Validates qty at row level
""" """
# get unique transactions to update # get unique transactions to update
for d in self.obj.doclist: for d in self.obj.doclist:
@@ -591,21 +603,22 @@ class StatusUpdater:
# get all qty where qty > compare_field # get all qty where qty > compare_field
item = sql(""" item = sql("""
select item_code, qty, `%(compare_field)s`, parenttype, parent from `tab%(target_dt)s` select item_code, `%(compare_ref_field)s`, `%(compare_field)s`, parenttype, parent from `tab%(target_dt)s`
where qty < `%(compare_field)s` and name="%(name)s" and docstatus=1 where `%(compare_ref_field)s` < `%(compare_field)s` and name="%(name)s" and docstatus=1
""" % args, as_dict=1) """ % args, as_dict=1)
if item: if item:
item = item[0] item = item[0]
item['idx'] = d.idx item['idx'] = d.idx
item['compare_ref_field'] = args['compare_ref_field']
if no_tolerance: if no_tolerance:
item['reduce_by'] = item[args['compare_field']] - item['qty'] item['reduce_by'] = item[args['compare_field']] - item[args['compare_ref_field']]
msgprint(""" msgprint("""
Row #%(idx)s: Max qty allowed for <b>Item %(item_code)s</b> against Row #%(idx)s: Max %(compare_ref_field)s allowed for <b>Item %(item_code)s</b> against
<b>%(parenttype)s %(parent)s</b> is <b>%(qty)s</b>. <b>%(parenttype)s %(parent)s</b> is <b>""" % item
+ cstr(item[args['compare_ref_field']]) + """</b>.
You must reduce the qty by %(reduce_by)s""" % item, raise_exception=1) You must reduce the %(compare_ref_field)s by %(reduce_by)s""" % item, raise_exception=1)
else: else:
self.check_overflow_with_tolerance(item, args) self.check_overflow_with_tolerance(item, args)
@@ -621,6 +634,7 @@ class StatusUpdater:
'target_dt' :'Sales Order Detail', 'target_dt' :'Sales Order Detail',
'target_parent_dt' :'Sales Order', 'target_parent_dt' :'Sales Order',
'target_parent_field' :'per_delivered', 'target_parent_field' :'per_delivered',
'target_ref_field' :'qty',
'source_dt' :'Delivery Note Detail', 'source_dt' :'Delivery Note Detail',
'source_field' :'qty', 'source_field' :'qty',
'join_field' :'prevdoc_detail_docname', 'join_field' :'prevdoc_detail_docname',
@@ -631,12 +645,13 @@ class StatusUpdater:
elif self.obj.doc.doctype=='Receivable Voucher': elif self.obj.doc.doctype=='Receivable Voucher':
self.update_qty({ self.update_qty({
'target_field' :'billed_qty', 'target_field' :'billed_amt',
'target_dt' :'Sales Order Detail', 'target_dt' :'Sales Order Detail',
'target_parent_dt' :'Sales Order', 'target_parent_dt' :'Sales Order',
'target_parent_field' :'per_billed', 'target_parent_field' :'per_billed',
'target_ref_field' :'amount',
'source_dt' :'RV Detail', 'source_dt' :'RV Detail',
'source_field' :'qty', 'source_field' :'amount',
'join_field' :'so_detail', 'join_field' :'so_detail',
'percent_join_field' :'sales_order', 'percent_join_field' :'sales_order',
'status_field' :'billing_status', 'status_field' :'billing_status',
@@ -644,12 +659,13 @@ class StatusUpdater:
}) })
self.update_qty({ self.update_qty({
'target_field' :'billed_qty', 'target_field' :'billed_amt',
'target_dt' :'Delivery Note Detail', 'target_dt' :'Delivery Note Detail',
'target_parent_dt' :'Delivery Note', 'target_parent_dt' :'Delivery Note',
'target_parent_field' :'per_billed', 'target_parent_field' :'per_billed',
'target_ref_field' :'amount',
'source_dt' :'RV Detail', 'source_dt' :'RV Detail',
'source_field' :'qty', 'source_field' :'amount',
'join_field' :'dn_detail', 'join_field' :'dn_detail',
'percent_join_field' :'delivery_note', 'percent_join_field' :'delivery_note',
'status_field' :'billing_status', 'status_field' :'billing_status',
@@ -662,6 +678,7 @@ class StatusUpdater:
'target_dt' :'Delivery Note Detail', 'target_dt' :'Delivery Note Detail',
'target_parent_dt' :'Delivery Note', 'target_parent_dt' :'Delivery Note',
'target_parent_field' :'per_installed', 'target_parent_field' :'per_installed',
'target_ref_field' :'qty',
'source_dt' :'Installed Item Details', 'source_dt' :'Installed Item Details',
'source_field' :'qty', 'source_field' :'qty',
'join_field' :'prevdoc_detail_docname', 'join_field' :'prevdoc_detail_docname',
@@ -692,7 +709,7 @@ class StatusUpdater:
update update
`tab%(target_dt)s` `tab%(target_dt)s`
set set
%(target_field)s = (select sum(qty) from `tab%(source_dt)s` where `%(join_field)s`="%(detail_id)s" and (docstatus=1 %(cond)s)) %(target_field)s = (select sum(%(source_field)s) from `tab%(source_dt)s` where `%(join_field)s`="%(detail_id)s" and (docstatus=1 %(cond)s))
where where
name="%(detail_id)s" name="%(detail_id)s"
""" % args) """ % args)
@@ -708,7 +725,7 @@ class StatusUpdater:
`tab%(target_parent_dt)s` `tab%(target_parent_dt)s`
set set
%(target_parent_field)s = %(target_parent_field)s =
(select sum(if(qty > ifnull(%(target_field)s, 0), %(target_field)s, qty))/sum(qty)*100 from `tab%(target_dt)s` where parent="%(name)s"), (select sum(if(%(target_ref_field)s > ifnull(%(target_field)s, 0), %(target_field)s, %(target_ref_field)s))/sum(%(target_ref_field)s)*100 from `tab%(target_dt)s` where parent="%(name)s"),
modified = now() modified = now()
where where
name="%(name)s" name="%(name)s"

View File

@@ -102,8 +102,7 @@ class DocType(TransactionBase):
'projected_qty' : tot_avail_qty and flt(tot_avail_qty[0]['projected_qty']) or 0, 'projected_qty' : tot_avail_qty and flt(tot_avail_qty[0]['projected_qty']) or 0,
'actual_qty' : tot_avail_qty and flt(tot_avail_qty[0]['actual_qty']) or 0 'actual_qty' : tot_avail_qty and flt(tot_avail_qty[0]['actual_qty']) or 0
} }
return cstr(ret) return ret
# OTHER CHARGES TRIGGER FUNCTIONS # OTHER CHARGES TRIGGER FUNCTIONS
# ==================================================================================== # ====================================================================================
@@ -136,7 +135,7 @@ class DocType(TransactionBase):
nm = nm and nm[0][0] or '' nm = nm and nm[0][0] or ''
if not nm: if not nm:
return cstr('No') return 'No'
#check if maintenance visit already generated #check if maintenance visit already generated
#============================================ #============================================
@@ -145,7 +144,7 @@ class DocType(TransactionBase):
nm = nm and nm[0][0] or '' nm = nm and nm[0][0] or ''
if not nm: if not nm:
return cstr('No') return 'No'
# VALIDATE # VALIDATE
# ===================================================================================== # =====================================================================================

View File

@@ -5,15 +5,14 @@
{ {
'creation': '2010-08-08 17:09:21', 'creation': '2010-08-08 17:09:21',
'docstatus': 0, 'docstatus': 0,
'modified': '2011-06-27 16:05:56', 'modified': '2011-08-09 17:06:09',
'modified_by': 'Administrator', 'modified_by': 'Administrator',
'owner': 'Administrator' 'owner': 'Administrator'
}, },
# These values are common for all DocType # These values are common for all DocType
{ {
'_last_update': '1309170956', '_last_update': '1311621379',
'client_script': "cur_frm.add_fetch('customer','sales_person','sales_person');",
'colour': 'White:FFF', 'colour': 'White:FFF',
'doctype': 'DocType', 'doctype': 'DocType',
'document_type': 'Transaction', 'document_type': 'Transaction',
@@ -28,7 +27,7 @@
'show_in_menu': 0, 'show_in_menu': 0,
'subject': 'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed', 'subject': 'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed',
'tag_fields': 'delivery_status,billing_status', 'tag_fields': 'delivery_status,billing_status',
'version': 593 'version': 597
}, },
# These values are common for all DocField # These values are common for all DocField
@@ -58,28 +57,23 @@
# DocPerm # DocPerm
{ {
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 1, 'idx': 1,
'permlevel': 1, 'permlevel': 0,
'role': 'Sales Manager', 'role': 'Production Manager'
'submit': 0,
'write': 0
}, },
# DocPerm # DocPerm
{ {
'amend': 1, 'amend': 0,
'cancel': 1, 'cancel': 0,
'create': 1, 'create': 0,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 2, 'idx': 2,
'permlevel': 0, 'permlevel': 1,
'role': 'Sales Manager', 'role': 'Sales Manager',
'submit': 1, 'submit': 0,
'write': 1 'write': 0
}, },
# DocPerm # DocPerm
@@ -90,6 +84,19 @@
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 3, 'idx': 3,
'permlevel': 0, 'permlevel': 0,
'role': 'Sales Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 4,
'permlevel': 0,
'role': 'Sales User', 'role': 'Sales User',
'submit': 1, 'submit': 1,
'write': 1 'write': 1
@@ -101,7 +108,7 @@
'cancel': 0, 'cancel': 0,
'create': 0, 'create': 0,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 4, 'idx': 5,
'permlevel': 1, 'permlevel': 1,
'role': 'Sales User', 'role': 'Sales User',
'submit': 0, 'submit': 0,
@@ -111,7 +118,7 @@
# DocPerm # DocPerm
{ {
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 5, 'idx': 6,
'match': 'customer_name', 'match': 'customer_name',
'permlevel': 0, 'permlevel': 0,
'role': 'Customer' 'role': 'Customer'
@@ -120,7 +127,7 @@
# DocPerm # DocPerm
{ {
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 6, 'idx': 7,
'permlevel': 2, 'permlevel': 2,
'role': 'Accounts User', 'role': 'Accounts User',
'write': 1 'write': 1
@@ -132,7 +139,7 @@
'cancel': 1, 'cancel': 1,
'create': 1, 'create': 1,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 7, 'idx': 8,
'permlevel': 0, 'permlevel': 0,
'role': 'Maintenance Manager', 'role': 'Maintenance Manager',
'submit': 1, 'submit': 1,
@@ -142,7 +149,7 @@
# DocPerm # DocPerm
{ {
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 8, 'idx': 9,
'permlevel': 1, 'permlevel': 1,
'role': 'Maintenance Manager' 'role': 'Maintenance Manager'
}, },
@@ -153,7 +160,7 @@
'cancel': 1, 'cancel': 1,
'create': 1, 'create': 1,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 9, 'idx': 10,
'permlevel': 0, 'permlevel': 0,
'role': 'Maintenance User', 'role': 'Maintenance User',
'submit': 1, 'submit': 1,
@@ -163,7 +170,7 @@
# DocPerm # DocPerm
{ {
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 10, 'idx': 11,
'permlevel': 1, 'permlevel': 1,
'role': 'Maintenance User' 'role': 'Maintenance User'
}, },
@@ -204,7 +211,7 @@
'no_copy': 1, 'no_copy': 1,
'oldfieldname': 'naming_series', 'oldfieldname': 'naming_series',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
'options': 'SO\nSO/10-11/', 'options': 'PI/2011/\nSO\nSO/10-11/\nSO1112',
'permlevel': 0, 'permlevel': 0,
'print_hide': 1, 'print_hide': 1,
'reqd': 1 'reqd': 1
@@ -504,7 +511,7 @@
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 23, 'idx': 23,
'in_filter': 1, 'in_filter': 1,
'label': '% Qty Billed', 'label': '% Amount Billed',
'no_copy': 1, 'no_copy': 1,
'oldfieldname': 'per_billed', 'oldfieldname': 'per_billed',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
@@ -605,6 +612,16 @@
'width': '150px' 'width': '150px'
}, },
# DocField
{
'doctype': 'DocField',
'fieldname': 'vehicle_detail',
'fieldtype': 'Small Text',
'idx': 30,
'label': 'Vehicle Detail',
'permlevel': 0
},
# DocField # DocField
{ {
'colour': 'White:FFF', 'colour': 'White:FFF',
@@ -612,7 +629,7 @@
'fieldname': 'quotation_date', 'fieldname': 'quotation_date',
'fieldtype': 'Date', 'fieldtype': 'Date',
'hidden': 1, 'hidden': 1,
'idx': 30, 'idx': 31,
'label': 'Quotation Date', 'label': 'Quotation Date',
'no_copy': 0, 'no_copy': 0,
'oldfieldname': 'quotation_date', 'oldfieldname': 'quotation_date',
@@ -627,7 +644,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Button', 'fieldtype': 'Button',
'idx': 31, 'idx': 32,
'label': 'Pull Quotation Details', 'label': 'Pull Quotation Details',
'oldfieldtype': 'Button', 'oldfieldtype': 'Button',
'options': 'pull_quotation_details', 'options': 'pull_quotation_details',
@@ -642,7 +659,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'price_list_name', 'fieldname': 'price_list_name',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 32, 'idx': 33,
'label': 'Price List', 'label': 'Price List',
'oldfieldname': 'price_list_name', 'oldfieldname': 'price_list_name',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
@@ -658,7 +675,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 33, 'idx': 34,
'permlevel': 0, 'permlevel': 0,
'width': '50%' 'width': '50%'
}, },
@@ -670,7 +687,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'currency', 'fieldname': 'currency',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 34, 'idx': 35,
'label': 'Currency', 'label': 'Currency',
'oldfieldname': 'currency', 'oldfieldname': 'currency',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
@@ -689,7 +706,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'conversion_rate', 'fieldname': 'conversion_rate',
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 35, 'idx': 36,
'label': 'Conversion Rate', 'label': 'Conversion Rate',
'oldfieldname': 'conversion_rate', 'oldfieldname': 'conversion_rate',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
@@ -704,7 +721,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 36, 'idx': 37,
'permlevel': 0 'permlevel': 0
}, },
@@ -715,7 +732,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'sales_order_details', 'fieldname': 'sales_order_details',
'fieldtype': 'Table', 'fieldtype': 'Table',
'idx': 37, 'idx': 38,
'label': 'Sales Order Details', 'label': 'Sales Order Details',
'oldfieldname': 'sales_order_details', 'oldfieldname': 'sales_order_details',
'oldfieldtype': 'Table', 'oldfieldtype': 'Table',
@@ -729,7 +746,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Button', 'fieldtype': 'Button',
'idx': 38, 'idx': 39,
'label': 'Clear Table', 'label': 'Clear Table',
'oldfieldtype': 'Button', 'oldfieldtype': 'Button',
'options': 'clear_sales_order_details', 'options': 'clear_sales_order_details',
@@ -741,7 +758,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Button', 'fieldtype': 'Button',
'idx': 39, 'idx': 40,
'label': 'Re-Calculate Values', 'label': 'Re-Calculate Values',
'oldfieldtype': 'Button', 'oldfieldtype': 'Button',
'permlevel': 0, 'permlevel': 0,
@@ -755,7 +772,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'net_total', 'fieldname': 'net_total',
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 40, 'idx': 41,
'label': 'Net Total*', 'label': 'Net Total*',
'oldfieldname': 'net_total', 'oldfieldname': 'net_total',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
@@ -770,7 +787,7 @@
'colour': 'White:FFF', 'colour': 'White:FFF',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'HTML', 'fieldtype': 'HTML',
'idx': 41, 'idx': 42,
'label': 'Note1', 'label': 'Note1',
'oldfieldtype': 'HTML', 'oldfieldtype': 'HTML',
'options': '<b>NOTE :</b> * In Base Currency', 'options': '<b>NOTE :</b> * In Base Currency',
@@ -783,7 +800,7 @@
'colour': 'White:FFF', 'colour': 'White:FFF',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 42, 'idx': 43,
'label': 'Taxes', 'label': 'Taxes',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Section Break',
'permlevel': 0, 'permlevel': 0,
@@ -795,7 +812,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'charge', 'fieldname': 'charge',
'fieldtype': 'Link', 'fieldtype': 'Link',
'idx': 43, 'idx': 44,
'label': 'Select Charges Master', 'label': 'Select Charges Master',
'oldfieldname': 'charge', 'oldfieldname': 'charge',
'oldfieldtype': 'Link', 'oldfieldtype': 'Link',
@@ -808,7 +825,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Button', 'fieldtype': 'Button',
'idx': 44, 'idx': 45,
'label': 'Get Charges', 'label': 'Get Charges',
'oldfieldtype': 'Button', 'oldfieldtype': 'Button',
'permlevel': 0, 'permlevel': 0,
@@ -820,7 +837,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'other_charges', 'fieldname': 'other_charges',
'fieldtype': 'Table', 'fieldtype': 'Table',
'idx': 45, 'idx': 46,
'label': 'Other Charges', 'label': 'Other Charges',
'oldfieldname': 'other_charges', 'oldfieldname': 'other_charges',
'oldfieldtype': 'Table', 'oldfieldtype': 'Table',
@@ -832,7 +849,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Button', 'fieldtype': 'Button',
'idx': 46, 'idx': 47,
'label': 'Calculate Charges', 'label': 'Calculate Charges',
'oldfieldtype': 'Button', 'oldfieldtype': 'Button',
'permlevel': 0, 'permlevel': 0,
@@ -845,7 +862,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'other_charges_total', 'fieldname': 'other_charges_total',
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 47, 'idx': 48,
'label': 'Charges Total*', 'label': 'Charges Total*',
'oldfieldname': 'other_charges_total', 'oldfieldname': 'other_charges_total',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
@@ -859,7 +876,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'grand_total', 'fieldname': 'grand_total',
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 48, 'idx': 49,
'label': 'Grand Total*', 'label': 'Grand Total*',
'oldfieldname': 'grand_total', 'oldfieldname': 'grand_total',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
@@ -873,7 +890,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'HTML', 'fieldtype': 'HTML',
'idx': 49, 'idx': 50,
'label': 'OT Notes', 'label': 'OT Notes',
'oldfieldtype': 'HTML', 'oldfieldtype': 'HTML',
'options': '<b>NOTE :</b> * In Base Currency', 'options': '<b>NOTE :</b> * In Base Currency',
@@ -885,7 +902,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'HTML', 'fieldtype': 'HTML',
'idx': 50, 'idx': 51,
'label': 'Other Charges Calculation', 'label': 'Other Charges Calculation',
'oldfieldtype': 'HTML', 'oldfieldtype': 'HTML',
'permlevel': 0, 'permlevel': 0,
@@ -897,7 +914,7 @@
'colour': 'White:FFF', 'colour': 'White:FFF',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 51, 'idx': 52,
'label': 'Totals', 'label': 'Totals',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Section Break',
'permlevel': 0, 'permlevel': 0,
@@ -909,7 +926,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'rounded_total', 'fieldname': 'rounded_total',
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 52, 'idx': 53,
'label': 'Rounded Total', 'label': 'Rounded Total',
'oldfieldname': 'rounded_total', 'oldfieldname': 'rounded_total',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
@@ -925,7 +942,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'in_words', 'fieldname': 'in_words',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 53, 'idx': 54,
'label': 'In Words', 'label': 'In Words',
'oldfieldname': 'in_words', 'oldfieldname': 'in_words',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@@ -938,7 +955,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 54, 'idx': 55,
'oldfieldtype': 'Column Break', 'oldfieldtype': 'Column Break',
'permlevel': 0, 'permlevel': 0,
'print_hide': 1, 'print_hide': 1,
@@ -950,7 +967,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'grand_total_export', 'fieldname': 'grand_total_export',
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 55, 'idx': 56,
'label': 'Grand Total (Export)', 'label': 'Grand Total (Export)',
'oldfieldname': 'grand_total_export', 'oldfieldname': 'grand_total_export',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
@@ -965,7 +982,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'rounded_total_export', 'fieldname': 'rounded_total_export',
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 56, 'idx': 57,
'label': 'Rounded Total (Export)', 'label': 'Rounded Total (Export)',
'oldfieldname': 'rounded_total_export', 'oldfieldname': 'rounded_total_export',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
@@ -981,7 +998,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'in_words_export', 'fieldname': 'in_words_export',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 57, 'idx': 58,
'label': 'In Words (Export)', 'label': 'In Words (Export)',
'oldfieldname': 'in_words_export', 'oldfieldname': 'in_words_export',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@@ -995,7 +1012,7 @@
'colour': 'White:FFF', 'colour': 'White:FFF',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 58, 'idx': 59,
'label': 'Terms', 'label': 'Terms',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Section Break',
'permlevel': 0, 'permlevel': 0,
@@ -1007,7 +1024,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'tc_name', 'fieldname': 'tc_name',
'fieldtype': 'Link', 'fieldtype': 'Link',
'idx': 59, 'idx': 60,
'label': 'Select Terms', 'label': 'Select Terms',
'oldfieldname': 'tc_name', 'oldfieldname': 'tc_name',
'oldfieldtype': 'Link', 'oldfieldtype': 'Link',
@@ -1021,7 +1038,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Button', 'fieldtype': 'Button',
'idx': 60, 'idx': 61,
'label': 'Get Terms', 'label': 'Get Terms',
'oldfieldtype': 'Button', 'oldfieldtype': 'Button',
'options': 'get_tc_details', 'options': 'get_tc_details',
@@ -1033,7 +1050,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'HTML', 'fieldtype': 'HTML',
'idx': 61, 'idx': 62,
'label': 'Terms HTML', 'label': 'Terms HTML',
'oldfieldtype': 'HTML', 'oldfieldtype': 'HTML',
'options': 'You can add Terms and Notes that will be printed in the Transaction', 'options': 'You can add Terms and Notes that will be printed in the Transaction',
@@ -1046,7 +1063,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'terms', 'fieldname': 'terms',
'fieldtype': 'Text Editor', 'fieldtype': 'Text Editor',
'idx': 62, 'idx': 63,
'label': 'Term Details', 'label': 'Term Details',
'oldfieldname': 'terms', 'oldfieldname': 'terms',
'oldfieldtype': 'Text Editor', 'oldfieldtype': 'Text Editor',
@@ -1060,7 +1077,7 @@
'description': 'Filling in additional information about the Sales Order will help you analyze your data better.', 'description': 'Filling in additional information about the Sales Order will help you analyze your data better.',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 63, 'idx': 64,
'label': 'More Info', 'label': 'More Info',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Section Break',
'permlevel': 0, 'permlevel': 0,
@@ -1071,7 +1088,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 64, 'idx': 65,
'oldfieldtype': 'Column Break', 'oldfieldtype': 'Column Break',
'permlevel': 0, 'permlevel': 0,
'print_hide': 1, 'print_hide': 1,
@@ -1084,7 +1101,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'letter_head', 'fieldname': 'letter_head',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 65, 'idx': 66,
'label': 'Letter Head', 'label': 'Letter Head',
'oldfieldname': 'letter_head', 'oldfieldname': 'letter_head',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
@@ -1100,7 +1117,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'company', 'fieldname': 'company',
'fieldtype': 'Link', 'fieldtype': 'Link',
'idx': 66, 'idx': 67,
'in_filter': 1, 'in_filter': 1,
'label': 'Company', 'label': 'Company',
'oldfieldname': 'company', 'oldfieldname': 'company',
@@ -1119,7 +1136,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'fiscal_year', 'fieldname': 'fiscal_year',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 67, 'idx': 68,
'in_filter': 1, 'in_filter': 1,
'label': 'Fiscal Year', 'label': 'Fiscal Year',
'oldfieldname': 'fiscal_year', 'oldfieldname': 'fiscal_year',
@@ -1139,7 +1156,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'select_print_heading', 'fieldname': 'select_print_heading',
'fieldtype': 'Link', 'fieldtype': 'Link',
'idx': 68, 'idx': 69,
'label': 'Select Print Heading', 'label': 'Select Print Heading',
'no_copy': 1, 'no_copy': 1,
'oldfieldname': 'select_print_heading', 'oldfieldname': 'select_print_heading',
@@ -1154,7 +1171,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 69, 'idx': 70,
'oldfieldtype': 'Column Break', 'oldfieldtype': 'Column Break',
'permlevel': 0, 'permlevel': 0,
'print_hide': 1, 'print_hide': 1,
@@ -1167,7 +1184,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'source', 'fieldname': 'source',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 70, 'idx': 71,
'label': 'Source', 'label': 'Source',
'oldfieldname': 'source', 'oldfieldname': 'source',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
@@ -1183,7 +1200,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'campaign', 'fieldname': 'campaign',
'fieldtype': 'Link', 'fieldtype': 'Link',
'idx': 71, 'idx': 72,
'label': 'Campaign', 'label': 'Campaign',
'oldfieldname': 'campaign', 'oldfieldname': 'campaign',
'oldfieldtype': 'Link', 'oldfieldtype': 'Link',
@@ -1198,7 +1215,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'note', 'fieldname': 'note',
'fieldtype': 'Text', 'fieldtype': 'Text',
'idx': 72, 'idx': 73,
'label': 'Note', 'label': 'Note',
'oldfieldname': 'note', 'oldfieldname': 'note',
'oldfieldtype': 'Text', 'oldfieldtype': 'Text',
@@ -1213,7 +1230,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'cancel_reason', 'fieldname': 'cancel_reason',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 73, 'idx': 74,
'label': 'Cancel Reason', 'label': 'Cancel Reason',
'no_column': 0, 'no_column': 0,
'no_copy': 1, 'no_copy': 1,
@@ -1229,7 +1246,7 @@
'fieldname': 'delivery_status', 'fieldname': 'delivery_status',
'fieldtype': 'Select', 'fieldtype': 'Select',
'hidden': 1, 'hidden': 1,
'idx': 74, 'idx': 75,
'label': 'Delivery Status', 'label': 'Delivery Status',
'no_column': 0, 'no_column': 0,
'no_copy': 1, 'no_copy': 1,
@@ -1244,7 +1261,7 @@
'fieldname': 'billing_status', 'fieldname': 'billing_status',
'fieldtype': 'Select', 'fieldtype': 'Select',
'hidden': 1, 'hidden': 1,
'idx': 75, 'idx': 76,
'label': 'Billing Status', 'label': 'Billing Status',
'no_column': 0, 'no_column': 0,
'no_copy': 1, 'no_copy': 1,
@@ -1260,7 +1277,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'hidden': 0, 'hidden': 0,
'idx': 76, 'idx': 77,
'label': 'Packing List', 'label': 'Packing List',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Section Break',
'permlevel': 0, 'permlevel': 0,
@@ -1273,7 +1290,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'packing_details', 'fieldname': 'packing_details',
'fieldtype': 'Table', 'fieldtype': 'Table',
'idx': 77, 'idx': 78,
'label': 'Packing Details', 'label': 'Packing Details',
'oldfieldname': 'packing_details', 'oldfieldname': 'packing_details',
'oldfieldtype': 'Table', 'oldfieldtype': 'Table',
@@ -1286,7 +1303,7 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 78, 'idx': 79,
'label': 'Sales Team', 'label': 'Sales Team',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Section Break',
'permlevel': 0, 'permlevel': 0,
@@ -1300,7 +1317,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'sales_partner', 'fieldname': 'sales_partner',
'fieldtype': 'Link', 'fieldtype': 'Link',
'idx': 79, 'idx': 80,
'in_filter': 1, 'in_filter': 1,
'label': 'Sales Partner', 'label': 'Sales Partner',
'oldfieldname': 'sales_partner', 'oldfieldname': 'sales_partner',
@@ -1318,7 +1335,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'commission_rate', 'fieldname': 'commission_rate',
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 80, 'idx': 81,
'label': 'Commission Rate', 'label': 'Commission Rate',
'oldfieldname': 'commission_rate', 'oldfieldname': 'commission_rate',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
@@ -1333,7 +1350,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'total_commission', 'fieldname': 'total_commission',
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 81, 'idx': 82,
'label': 'Total Commission', 'label': 'Total Commission',
'oldfieldname': 'total_commission', 'oldfieldname': 'total_commission',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
@@ -1347,7 +1364,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'sales_team', 'fieldname': 'sales_team',
'fieldtype': 'Table', 'fieldtype': 'Table',
'idx': 82, 'idx': 83,
'label': 'Sales Team1', 'label': 'Sales Team1',
'oldfieldname': 'sales_team', 'oldfieldname': 'sales_team',
'oldfieldtype': 'Table', 'oldfieldtype': 'Table',
@@ -1361,7 +1378,7 @@
'allow_on_submit': 1, 'allow_on_submit': 1,
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Button', 'fieldtype': 'Button',
'idx': 83, 'idx': 84,
'label': 'Repair Sales Order', 'label': 'Repair Sales Order',
'oldfieldtype': 'Button', 'oldfieldtype': 'Button',
'options': 'repair_sales_order', 'options': 'repair_sales_order',

View File

@@ -13,7 +13,7 @@ class DocType:
for r in res: for r in res:
ret[cstr(r[0])]=r[1] and cstr(r[1]) or '' ret[cstr(r[0])]=r[1] and cstr(r[1]) or ''
return str(ret) return ret
def set_cp_value(self, key): def set_cp_value(self, key):
""" """

View File

@@ -28,4 +28,4 @@ class DocType:
# #
def set_html_from_image(self): def set_html_from_image(self):
file_name = self.doc.file_list.split(',')[0] file_name = self.doc.file_list.split(',')[0]
self.doc.header_html = '<div><img src="cgi-bin/getfile.cgi?name=' + file_name + '"/></div>' self.doc.header_html = '<div><img style="max-height: 120px; max-width: 600px" src="index.cgi?cmd=get_file&fname=' + file_name + '"/></div>'

View File

@@ -32,7 +32,7 @@
</tbody> </tbody>
</table> </table>
</form> </form>
<div style="background-color: #FFE; padding: 10px; margin: 10px;"> <div style="background-color: #FFE; padding: 13px; margin: 17px;">
<h3>Data Import Guide</h3> <h3>Data Import Guide</h3>
<ol> <ol>
<li>Get the template of the DocType for which you want to import in CSV (Comma seperated values) format.</li> <li>Get the template of the DocType for which you want to import in CSV (Comma seperated values) format.</li>

View File

@@ -7,27 +7,28 @@ pscript['onload_Import Data'] = function() {
var sel = $i('import_template'); var sel = $i('import_template');
if(r.message){ if(r.message){
add_sel_options(sel, r.message); add_sel_options(sel, r.message);
// please collapse here when editing :)
sel.onchange=function(){ sel.onchange=function(){
$i('child_tab_lst').innerHTML =''; $i('child_tab_lst').innerHTML ='';
if(sel.value != 'Select Master...'){ if(sel.value != 'Select Master...'){
$c_obj('Import Data Control','get_child_lst',sel.value, $c_obj('Import Data Control','get_child_lst',sel.value,
function(r,rt){ function(r,rt){
var me = this; var me = this;
$y($i('child_tab_lst'),{backgroundColor:'#EEEEEE'}) $y($i('child_tab_lst'),{backgroundColor:'#EEEEEE', margin: '17px 17px', padding: '13px'})
var desc = $a($i('child_tab_lst'), 'div', '', {padding:'8px'}); var desc = $a($i('child_tab_lst'), 'div', '', {padding:'4px'});
desc.innerHTML = "<h4>Please click on following link(s) to download template.</h4>"; desc.innerHTML = "<b>Download template(s) for importing "+sel_val(sel)+"</b>";
var parent = $a($i('child_tab_lst'), 'div'); var parent = $a($i('child_tab_lst'), 'div');
var tab = make_table(parent,r.message.length,1,'100%',[],{padding:'8px',fontSize:'15px',borderCollapse: 'collapse'}); var tab = make_table(parent,r.message.length,1,'100%',[],{padding:'3px',borderCollapse: 'collapse'});
for(var i=0;i<r.message.length;i++){ for(var i=0;i<r.message.length;i++){
var dt= $a($td(tab,i,0), 'span', 'link_type'); var dt= $a($td(tab,i,0), 'span', 'link_type');
dt.innerHTML = r.message[i]; dt.innerHTML = r.message[i];
dt.nm = r.message[i]; dt.nm = r.message[i];
dt.onclick = function(){ dt.onclick = function(){
var ovr = $('input[name="overwrite"]:checked').length; var ovr = $('input[name="overwrite"]:checked').length;
window.location = outUrl + '?cmd=get_template&dt=' + this.nm + (ovr ? '&overwrite=1' : ''); window.location = outUrl + '?cmd=get_template&dt=' + this.nm + (ovr ? '&overwrite=1' : '');
@@ -38,6 +39,15 @@ pscript['onload_Import Data'] = function() {
} }
} }
} }
// set the default (if given in url)
if(window.location.hash) {
var to_set = window.location.hash.split('/').slice(-1)[0];
if(in_list(r.message, to_set)) {
sel.value = to_set;
sel.onchange();
}
}
} }
$c_obj('Import Data Control','get_master_lst','',callback); $c_obj('Import Data Control','get_master_lst','',callback);

View File

@@ -40,15 +40,10 @@ class DocType(TransactionBase):
def validate_fiscal_year(self): def validate_fiscal_year(self):
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date') get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
# ******************* Get Customer Details ***********************
#def get_customer_details(self):
# sales_com_obj = get_obj('Sales Common')
# sales_com_obj.get_customer_details(self)
# sales_com_obj.get_shipping_details(self)
# ****** Get contact person details based on customer selected **** # ****** Get contact person details based on customer selected ****
def get_contact_details(self): def get_contact_details(self):
return cstr(get_obj('Sales Common').get_contact_details(self,0)) return get_obj('Sales Common').get_contact_details(self,0)
# *********** Get Commission rate of Sales Partner **************** # *********** Get Commission rate of Sales Partner ****************
def get_comm_rate(self, sales_partner): def get_comm_rate(self, sales_partner):
@@ -122,7 +117,7 @@ class DocType(TransactionBase):
ret = { ret = {
'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0 'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
} }
return cstr(ret) return ret
# OTHER CHARGES TRIGGER FUNCTIONS # OTHER CHARGES TRIGGER FUNCTIONS

View File

@@ -3,16 +3,16 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2010-08-08 17:08:57', 'creation': '2011-04-18 15:58:20',
'docstatus': 0, 'docstatus': 0,
'modified': '2011-06-27 16:42:01', 'modified': '2011-08-09 17:10:45',
'modified_by': 'Administrator', 'modified_by': 'Administrator',
'owner': 'Administrator' 'owner': 'Administrator'
}, },
# These values are common for all DocType # These values are common for all DocType
{ {
'_last_update': '1309173122', '_last_update': '1311621379',
'colour': 'White:FFF', 'colour': 'White:FFF',
'doctype': 'DocType', 'doctype': 'DocType',
'document_type': 'Transaction', 'document_type': 'Transaction',
@@ -27,7 +27,7 @@
'show_in_menu': 0, 'show_in_menu': 0,
'subject': 'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed', 'subject': 'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
'tag_fields': 'billing_status', 'tag_fields': 'billing_status',
'version': 444 'version': 446
}, },
# These values are common for all DocField # These values are common for all DocField
@@ -70,15 +70,15 @@
# DocPerm # DocPerm
{ {
'amend': 0, 'amend': 1,
'cancel': 0, 'cancel': 1,
'create': 0, 'create': 1,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 2, 'idx': 2,
'permlevel': 1, 'permlevel': 0,
'role': 'Material User', 'role': 'Sales User',
'submit': 0, 'submit': 1,
'write': 0 'write': 1
}, },
# DocPerm # DocPerm
@@ -89,22 +89,22 @@
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 3, 'idx': 3,
'permlevel': 0, 'permlevel': 0,
'role': 'Material Manager', 'role': 'Material Master Manager',
'submit': 1, 'submit': 1,
'write': 1 'write': 1
}, },
# DocPerm # DocPerm
{ {
'amend': 0, 'amend': 1,
'cancel': 0, 'cancel': 1,
'create': 0, 'create': 1,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 4, 'idx': 4,
'permlevel': 1, 'permlevel': 0,
'role': 'Material Manager', 'role': 'Material Manager',
'submit': 0, 'submit': 1,
'write': 0 'write': 1
}, },
# DocPerm # DocPerm
@@ -115,60 +115,25 @@
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 5, 'idx': 5,
'permlevel': 0, 'permlevel': 0,
'role': 'Sales User', 'role': 'Sales Manager',
'submit': 1, 'submit': 1,
'write': 1 'write': 1
}, },
# DocPerm # DocPerm
{ {
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 6, 'idx': 6,
'permlevel': 1, 'permlevel': 1,
'role': 'Sales User', 'role': 'All'
'submit': 0,
'write': 0
}, },
# DocPerm # DocPerm
{ {
'cancel': 0,
'create': 0,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 7, 'idx': 7,
'permlevel': 0,
'role': 'Accounts User',
'submit': 0,
'write': 0
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 8,
'permlevel': 1,
'role': 'Accounts User'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 9,
'match': 'customer_name',
'permlevel': 0,
'role': 'Customer'
},
# DocPerm
{
'doctype': 'DocPerm',
'idx': 10,
'permlevel': 2, 'permlevel': 2,
'role': 'All', 'role': 'All'
'write': 1
}, },
# DocField # DocField
@@ -332,7 +297,7 @@
'permlevel': 0, 'permlevel': 0,
'print_hide': 0, 'print_hide': 0,
'reqd': 1, 'reqd': 1,
'search_index': 0, 'search_index': 1,
'width': '100px' 'width': '100px'
}, },
@@ -352,7 +317,7 @@
'permlevel': 1, 'permlevel': 1,
'print_hide': 1, 'print_hide': 1,
'reqd': 1, 'reqd': 1,
'search_index': 0, 'search_index': 1,
'width': '150px' 'width': '150px'
}, },
@@ -366,13 +331,13 @@
'fieldtype': 'Currency', 'fieldtype': 'Currency',
'idx': 15, 'idx': 15,
'in_filter': 1, 'in_filter': 1,
'label': '% Qty Billed', 'label': '% Amount Billed',
'no_copy': 1, 'no_copy': 1,
'oldfieldname': 'per_billed', 'oldfieldname': 'per_billed',
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
'permlevel': 1, 'permlevel': 1,
'print_hide': 1, 'print_hide': 1,
'search_index': 0 'search_index': 1
}, },
# DocField # DocField
@@ -391,7 +356,7 @@
'oldfieldtype': 'Currency', 'oldfieldtype': 'Currency',
'permlevel': 1, 'permlevel': 1,
'print_hide': 1, 'print_hide': 1,
'search_index': 0 'search_index': 1
}, },
# DocField # DocField
@@ -439,7 +404,7 @@
'permlevel': 0, 'permlevel': 0,
'print_hide': 1, 'print_hide': 1,
'reqd': 1, 'reqd': 1,
'search_index': 0 'search_index': 1
}, },
# DocField # DocField
@@ -453,7 +418,7 @@
'options': 'Customer Group', 'options': 'Customer Group',
'permlevel': 0, 'permlevel': 0,
'print_hide': 1, 'print_hide': 1,
'search_index': 0 'search_index': 1
}, },
# DocField # DocField
@@ -1014,7 +979,7 @@
'permlevel': 0, 'permlevel': 0,
'print_hide': 1, 'print_hide': 1,
'reqd': 1, 'reqd': 1,
'search_index': 0, 'search_index': 1,
'width': '150px' 'width': '150px'
}, },
@@ -1032,7 +997,7 @@
'permlevel': 0, 'permlevel': 0,
'print_hide': 1, 'print_hide': 1,
'reqd': 1, 'reqd': 1,
'search_index': 0, 'search_index': 1,
'width': '150px' 'width': '150px'
}, },

View File

@@ -1,25 +0,0 @@
import unittest
import webnotes
from webnotes.model.code import get_obj
class SubmissionTest(unittest.TestCase):
def setUp(self):
self.dn = webnotes.testing.create('Delivery Note')
self.dn_items = []
# get a line item for testing
for d in self.dn.doclist:
if d.doctype=='Delivery Note Detail':
self.dn_items.append(d)
self.old_bin = get_obj('Warehouse', self.line_item[0].warehouse).get_bin(self.line_item[0].item_code)
self.dn.on_submit()
def test_bin_is_updated(self):
"tests if bin quantity is affected when on submission"
bin = get_obj('Warehouse', self.line_item.warehouse).get_bin(self.line_item[0].item_code)
self.assertTrue(bin.actual_qty == self.old_bin.actual_qty - self.line_item[0].qty)
def test_sales_order_is_updated(self):
"tests if"

View File

@@ -27,7 +27,7 @@ class DocType:
ret = { ret = {
'tax_rate' : rate and flt(rate[0][0]) or 0 'tax_rate' : rate and flt(rate[0][0]) or 0
} }
return str(ret) return ret
def on_update(self): def on_update(self):
bin = sql("select stock_uom from `tabBin` where item_code = '%s' " % self.doc.item_code) bin = sql("select stock_uom from `tabBin` where item_code = '%s' " % self.doc.item_code)
@@ -178,3 +178,7 @@ Total Available Qty: %s
sle = sql("select name from `tabStock Ledger Entry` where item_code = %s and ifnull(is_cancelled, 'No') = 'No'", self.doc.name) sle = sql("select name from `tabStock Ledger Entry` where item_code = %s and ifnull(is_cancelled, 'No') = 'No'", self.doc.name)
return sle and 'exists' or 'not exists' return sle and 'exists' or 'not exists'
def on_rename(self,newdn,olddn):
sql("update tabItem set item_code = %s where name = %s", (newdn, olddn))

View File

@@ -43,17 +43,14 @@ class DocType(TransactionBase):
def validate_fiscal_year(self): def validate_fiscal_year(self):
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Transaction Date') get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Transaction Date')
# Get Supplier Details
#def get_supplier_details(self, name = ''):
# return cstr(get_obj(dt='Purchase Common').get_supplier_details(name))
# Get Item Details # Get Item Details
def get_item_details(self, arg = ''): def get_item_details(self, arg = ''):
return cstr(get_obj(dt='Purchase Common').get_item_details(self,arg)) return get_obj(dt='Purchase Common').get_item_details(self,arg)
# Get UOM Details # Get UOM Details
def get_uom_details(self, arg = ''): def get_uom_details(self, arg = ''):
return cstr(get_obj(dt='Purchase Common').get_uom_details(arg)) return get_obj(dt='Purchase Common').get_uom_details(arg)
# GET TERMS & CONDITIONS # GET TERMS & CONDITIONS
# ===================================================================================== # =====================================================================================
@@ -62,7 +59,7 @@ class DocType(TransactionBase):
# get available qty at warehouse # get available qty at warehouse
def get_bin_details(self, arg = ''): def get_bin_details(self, arg = ''):
return cstr(get_obj(dt='Purchase Common').get_bin_details(arg)) return get_obj(dt='Purchase Common').get_bin_details(arg)f
# Pull Purchase Order # Pull Purchase Order
def get_po_details(self): def get_po_details(self):

View File

@@ -38,7 +38,7 @@ class DocType:
def get_item_details(self, name): def get_item_details(self, name):
det = sql("select description, stock_uom from `tabItem` where name = '%s' " % cstr(name)) det = sql("select description, stock_uom from `tabItem` where name = '%s' " % cstr(name))
rate = sql("select ref_rate from `tabRef Rate Detail` where price_list_name = %s and parent = %s and ref_currency = %s", (self.doc.price_list, name, self.doc.currency)) rate = sql("select ref_rate from `tabRef Rate Detail` where price_list_name = %s and parent = %s and ref_currency = %s", (self.doc.price_list, name, self.doc.currency))
return cstr({'description' : det and det[0][0] or '', 'uom': det and det[0][1] or '', 'rate': rate and flt(rate[0][0]) or 0.00}) return {'description' : det and det[0][0] or '', 'uom': det and det[0][1] or '', 'rate': rate and flt(rate[0][0]) or 0.00}
def get_main_item(self): def get_main_item(self):

View File

@@ -54,7 +54,7 @@ class DocType:
'conversion_factor' : 1, 'conversion_factor' : 1,
'batch_no' : '' 'batch_no' : ''
} }
return str(ret) return ret
# Get UOM Details # Get UOM Details
@@ -70,7 +70,7 @@ class DocType:
'conversion_factor' : flt(uom[0]['conversion_factor']), 'conversion_factor' : flt(uom[0]['conversion_factor']),
'transfer_qty' : flt(arg['qty']) * flt(uom[0]['conversion_factor']), 'transfer_qty' : flt(arg['qty']) * flt(uom[0]['conversion_factor']),
} }
return str(ret) return ret
# get stock and incoming rate on posting date # get stock and incoming rate on posting date
@@ -396,7 +396,7 @@ class DocType:
'customer_name' : res and res[0][1] or '', 'customer_name' : res and res[0][1] or '',
'customer_address' : res and res[0][2] or ''} 'customer_address' : res and res[0][2] or ''}
return str(ret) return ret
def get_cust_addr(self): def get_cust_addr(self):
@@ -405,7 +405,7 @@ class DocType:
'customer_name' : res and res[0][0] or '', 'customer_name' : res and res[0][0] or '',
'customer_address' : res and res[0][1] or ''} 'customer_address' : res and res[0][1] or ''}
return str(ret) return ret
@@ -415,7 +415,7 @@ class DocType:
'supplier' : res and res[0][0] or '', 'supplier' : res and res[0][0] or '',
'supplier_name' :res and res[0][1] or '', 'supplier_name' :res and res[0][1] or '',
'supplier_address' : res and res[0][2] or ''} 'supplier_address' : res and res[0][2] or ''}
return str(ret) return ret
def get_supp_addr(self): def get_supp_addr(self):
@@ -423,4 +423,4 @@ class DocType:
ret = { ret = {
'supplier_name' : res and res[0][0] or '', 'supplier_name' : res and res[0][0] or '',
'supplier_address' : res and res[0][1] or ''} 'supplier_address' : res and res[0][1] or ''}
return str(ret) return ret

View File

@@ -253,7 +253,8 @@
'no_copy': 1, 'no_copy': 1,
'oldfieldname': 'serial_no', 'oldfieldname': 'serial_no',
'oldfieldtype': 'Text', 'oldfieldtype': 'Text',
'permlevel': 0 'permlevel': 0,
'reqd': 0
}, },
# DocField # DocField

View File

@@ -22,7 +22,7 @@ class DocType:
self.doc, self.doclist = d,dl self.doc, self.doclist = d,dl
def get_stock_uom(self, item_code): def get_stock_uom(self, item_code):
return cstr({'current_stock_uom': cstr(get_value('Item', item_code, 'stock_uom'))}) return {'current_stock_uom': cstr(get_value('Item', item_code, 'stock_uom'))}
def validate_mandatory(self): def validate_mandatory(self):
if not cstr(self.doc.item_code): if not cstr(self.doc.item_code):

View File

@@ -28,37 +28,6 @@ class DocType(TransactionBase):
#self.doc.name = make_autoname('CI/' + self.doc.fiscal_year + '/.######') #self.doc.name = make_autoname('CI/' + self.doc.fiscal_year + '/.######')
self.doc.name = make_autoname(self.doc.naming_series + '.######') self.doc.name = make_autoname(self.doc.naming_series + '.######')
#def get_customer_details(self):
# details = sql("select address, territory, customer_group, customer_name from `tabCustomer` where name = '%s' and docstatus != 2" %(self.doc.customer), as_dict = 1)
# if details:
# ret = {
# 'customer_address' : details and details[0]['address'] or '',
# 'customer_name' : details and details[0]['customer_name'] or '',
# 'territory' : details and details[0]['territory'] or '',
# 'customer_group' : details and details[0]['customer_group'] or ''
# }
# # ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
# contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where customer_name = '%s' and is_customer = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(self.doc.customer), as_dict = 1)
# ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
# ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
# ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
#
# return cstr(ret)
# else:
# msgprint("Customer : %s does not exist in system." % (name))
# raise Exception
# Get customer's contact person details
# ==============================================================
#def get_contact_details(self):
# contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s' and docstatus != 2" %(self.doc.contact_person, self.doc.customer), as_dict = 1)
# ret = {
# 'contact_no' : contact and contact[0]['contact_no'] or '',
# 'email_id' : contact and contact[0]['email_id'] or ''
# }
# return str(ret)
#check if maintenance schedule already generated #check if maintenance schedule already generated
#============================================ #============================================
def check_maintenance_visit(self): def check_maintenance_visit(self):
@@ -66,7 +35,7 @@ class DocType(TransactionBase):
nm = nm and nm[0][0] or '' nm = nm and nm[0][0] or ''
if not nm: if not nm:
return cstr('No') return 'No'
def on_submit(self): def on_submit(self):
if session['user'] != 'Guest': if session['user'] != 'Guest':

View File

@@ -38,20 +38,7 @@ class DocType(TransactionBase):
'item_name': item and item[0]['item_name'] or '', 'item_name': item and item[0]['item_name'] or '',
'description' : item and item[0]['description'] or '' 'description' : item and item[0]['description'] or ''
} }
return str(ret) return ret
#pull customer details
#-------------------------
#def get_customer_details(self):
# det = sql("select t1.customer_name,t1.address,t1.territory,t2.contact_name from `tabCustomer` t1, `tabContact` t2 where t1.name = %s and t1.name=t2.customer and t2.is_primary_contact = 'Yes'", self.doc.customer, as_dict=1)
#
# ret = {
# 'customer_name': det and det[0]['customer_name'] or '',
# 'address' : det and det[0]['address'] or '',
# 'territory': det and det[0]['territory'] or '',
# 'contact_person' : det and det[0]['contact_name'] or ''
# }
# return str(ret)
# generate maintenance schedule # generate maintenance schedule
#------------------------------------- #-------------------------------------
@@ -132,7 +119,7 @@ class DocType(TransactionBase):
count = period/365 count = period/365
ret = {'no_of_visits':count} ret = {'no_of_visits':count}
return str(ret) return ret
def validate_maintenance_detail(self): def validate_maintenance_detail(self):
if not getlist(self.doclist, 'item_maintenance_detail'): if not getlist(self.doclist, 'item_maintenance_detail'):

View File

@@ -31,20 +31,7 @@ class DocType(TransactionBase):
'item_name' : item and item[0]['item_name'] or '', 'item_name' : item and item[0]['item_name'] or '',
'description' : item and item[0]['description'] or '' 'description' : item and item[0]['description'] or ''
} }
return str(ret) return ret
#get customer details
#-----------------------
#def get_customer_details(self):
# det = sql("select t1.customer_name,t1.address,t1.territory,t2.contact_name from `tabCustomer` t1, `tabContact` t2 where t1.name = %s and t1.name=t2.customer and t2.is_primary_contact = 'Yes'", self.doc.customer, as_dict=1)
#
# ret = {
# 'customer_name' : det and det[0]['customer_name'] or '',
# 'address' : det and det[0]['address'] or '',
# 'territory': det and det[0]['territory'] or '',
# 'contact_person' : det and det[0]['contact_name'] or ''
# }
# return str(ret)
# fetch details of resp Sales order or customer issue # fetch details of resp Sales order or customer issue
#----------------------------------------------------------- #-----------------------------------------------------------

View File

@@ -85,14 +85,14 @@ We will get back to you as soon as possible
[This is an automatic response] [This is an automatic response]
""" + signature) """ + (signature or ''))
from webnotes.utils.email_lib import sendmail from webnotes.utils.email_lib import sendmail
sendmail(\ sendmail(\
recipients = [d.raised_by], \ recipients = [d.raised_by], \
sender = self.email_settings.support_email, \ sender = self.email_settings.support_email, \
subject = '['+d.name+'] ' + d.subject, \ subject = '['+d.name+'] ' + str(d.subject or ''), \
msg = response) msg = response)
def auto_close_tickets(self): def auto_close_tickets(self):

View File

@@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2011-07-07 17:47:52', 'creation': '2011-07-08 11:14:15',
'docstatus': 0, 'docstatus': 0,
'modified': '2011-07-27 13:19:22', 'modified': '2011-07-26 00:59:27',
'modified_by': 'Administrator', 'modified_by': 'Administrator',
'owner': 'Administrator' 'owner': 'Administrator'
}, },

View File

@@ -86,6 +86,7 @@ class DocType:
d.parenttype = 'DocType' d.parenttype = 'DocType'
d.parentfield = 'permissions' d.parentfield = 'permissions'
d.permlevel = level
d.role = role d.role = role
d.read = read d.read = read
d.write = write d.write = write