Merge branch 'shf_rename'

Conflicts:
	erpnext/patches/patch_list.py
This commit is contained in:
Anand Doshi 2012-05-14 12:53:29 +05:30
commit 4a3d3d75de
18 changed files with 83 additions and 265 deletions

View File

@ -4,7 +4,8 @@ wn.doclistviews['Journal Voucher'] = wn.views.ListView.extend({
this.fields = this.fields.concat([
'`tabJournal Voucher`.voucher_type',
'`tabJournal Voucher`.remark',
'`tabJournal Voucher`.total_debit'
'`tabJournal Voucher`.total_debit',
'`tabJournal Voucher`.company',
]);
this.stats = this.stats.concat(['voucher_type']);
},
@ -25,7 +26,7 @@ wn.doclistviews['Journal Voucher'] = wn.views.ListView.extend({
{
width: '18%',
content: function(parent, data) {
$(parent).html(sys_defaults.currency + ' ' + fmt_money(data.total_debit))
$(parent).html(wn.boot.company[data.company].default_currency + ' ' + fmt_money(data.total_debit))
},
css: {'text-align':'right'}
},

View File

@ -97,10 +97,18 @@ class DocType(TransactionBase):
self.validate_duplicate_docname('purchase_order')
self.doclist = get_obj('DocType Mapper', 'Purchase Order-Purchase Invoice').dt_map('Purchase Order', 'Purchase Invoice', self.doc.purchase_order_main, self.doc, self.doclist, "[['Purchase Order', 'Purchase Invoice'],['Purchase Order Item', 'Purchase Invoice Item'], ['Purchase Taxes and Charges','Purchase Taxes and Charges']]")
ret = self.get_credit_to()
self.get_expense_account('entries')
ret = self.get_credit_to()
if ret.has_key('credit_to'):
self.doc.credit_to = ret['credit_to']
def get_expense_account(self, doctype):
for d in getlist(self.doclist, doctype):
if d.item_code:
item = webnotes.conn.sql("select purchase_account, cost_center from tabItem where name = '%s'" %(d.item_code), as_dict=1)
d.expense_head = item and item[0]['purchase_account'] or ''
d.cost_center = item and item[0]['cost_center'] or ''
# Get Item Details

View File

@ -177,14 +177,13 @@ class DocType(TransactionBase):
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
ret = obj.get_item_details(arg, self)
ret = self.get_pos_details(arg, ret)
ret = self.get_pos_details(arg)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]
def get_pos_details(self, args, ret):
def get_pos_details(self, args, ret = {}):
if args['item_code'] and cint(self.doc.is_pos) == 1:
dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where user = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
if not dtl:

View File

@ -17,7 +17,7 @@
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.model import db_exists
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
from webnotes.model.doclist import getlist, copy_doclist
@ -188,6 +188,7 @@ class DocType(TransactionBase):
# Send mail
#=======================================================
def send_mail_funct(self):
from webnotes.utils.email_lib import sendmail
emailid_ret=sql("select company_email from `tabEmployee` where name = '%s'"%self.doc.employee)
if emailid_ret:
receiver = cstr(emailid_ret[0][0])
@ -278,6 +279,6 @@ class DocType(TransactionBase):
<td width='25%%'><b>Net Pay(in words) : </td><td colspan = '3' width = '50%%'>%s</b></td>
</tr>
</table></div>'''%(cstr(letter_head[0][0]),cstr(self.doc.employee), cstr(self.doc.employee_name), cstr(self.doc.month), cstr(self.doc.fiscal_year), cstr(self.doc.department), cstr(self.doc.branch), cstr(self.doc.designation), cstr(self.doc.grade), cstr(self.doc.bank_account_no), cstr(self.doc.bank_name), cstr(self.doc.arrear_amount), cstr(self.doc.payment_days), earn_table, ded_table, cstr(flt(self.doc.gross_pay)), cstr(flt(self.doc.total_deduction)), cstr(flt(self.doc.net_pay)), cstr(self.doc.total_in_words))
sendmail([receiver], sender='automail@erpnext.com', subject=subj, parts=[['text/plain', msg]])
sendmail([receiver], subject=subj, msg = msg)
else:
msgprint("Company Email ID not found.")

View File

@ -0,0 +1,5 @@
def execute():
import webnotes
sr = webnotes.conn.sql("select max(name) from `tabPage Role`")
if sr and sr[0][0].startswith('PR'):
webnotes.conn.sql("update tabSeries set current = %s where name = 'PR'", int(sr[0][0][2:]))

View File

@ -0,0 +1,6 @@
def execute():
import webnotes
from webnotes.modules import reload_doc
reload_doc('selling', 'search_criteria', 'itemwise_sales_details')
reload_doc('selling', 'search_criteria', 'itemwise_delivery_details')

View File

@ -342,5 +342,14 @@ patch_list = [
'patch_file': 'cms',
'description': 'generate html pages'
},
{
'patch_module': 'patches.may_2012',
'patch_file': 'reload_reports',
'description': 'reload reports: itemwise sales/delivery details'
},
{
'patch_module': 'patches.may_2012',
'patch_file': 'page_role_series_fix',
'description': 'reset series of page role at max'
},
]

View File

@ -83,7 +83,7 @@ class DocType(TransactionBase):
if doc.fields.get('item_code'):
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
ret = obj.get_item_details(arg, self)
ret = obj.get_item_defaults(arg, self)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]

View File

@ -156,6 +156,22 @@ class DocType(TransactionBase):
ret['base_ref_rate'] = flt(base_ref_rate)
ret['basic_rate'] = flt(base_ref_rate)
return ret
def get_item_defaults(self, args):
item = webnotes.conn.sql("""select default_warehouse, default_income_account, default_sales_cost_center from `tabItem`
where name = '%s' and (ifnull(end_of_life,'') = '' or end_of_life > now() or end_of_life = '0000-00-00')
and (is_sales_item = 'Yes' or is_service_item = 'Yes') """ % (args['item_code']), as_dict=1)
ret = {
'reserved_warehouse' : item and item[0]['default_warehouse'] or '',
'warehouse' : item and item[0]['default_warehouse'] or args.get('warehouse'),
'income_account' : item and item[0]['default_income_account'] or args.get('income_account'),
'cost_center' : item and item[0]['default_sales_cost_center'] or args.get('cost_center')
}
return ret
# ***************** Get Ref rate as entered in Item Master ********************
def get_ref_rate(self, item_code, price_list_name, price_list_currency, plc_conv_rate):

View File

@ -100,7 +100,7 @@ class DocType(TransactionBase):
if doc.fields.get('item_code'):
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
ret = obj.get_item_details(arg, self)
ret = obj.get_item_defaults(arg, self)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]

View File

@ -88,6 +88,13 @@ def boot_session(bootinfo):
if hasattr(conf, 'max_users'): bootinfo['max_users'] = conf.max_users
if hasattr(conf, 'expires_on'): bootinfo['expires_on'] = conf.expires_on
company = webnotes.conn.sql("select name, default_currency from `tabCompany`", as_dict=1)
company_dict = {}
for c in company:
company_dict.setdefault(c['name'], {}).update(c)
bootinfo['company'] = company_dict
def get_letter_heads():

View File

@ -117,7 +117,7 @@ class DocType(TransactionBase):
if doc.fields.get('item_code'):
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
ret = obj.get_item_details(arg, self)
ret = obj.get_item_defaults(arg, self)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]

View File

@ -94,13 +94,13 @@ class DocType:
def validate_posting_time(self):
""" Validate posting time format"""
if self.doc.posting_time and len(cstr(self.doc.posting_time)) == 8 and cstr(self.doc.posting_time)[-2:] != '00':
if self.doc.posting_time and len(self.doc.posting_time.split(':')) > 2:
msgprint("Wrong format of posting time, can not complete the transaction. If you think \
you entered posting time correctly, please contact ERPNext support team.")
raise Exception
def scrub_posting_time(self):
if not self.doc.posting_time or self.doc.posting_time == '12:0':
if not self.doc.posting_time or self.doc.posting_time == '00:0':
self.doc.posting_time = '00:00'
if len(self.doc.posting_time.split(':')) > 2:
self.doc.posting_time = '00:00'

View File

@ -1,134 +1,20 @@
#body_div {
body {
background: url("../files/indian-textile-5.gif") repeat;
background-color: #9CA2AD;
font-family: 'Arial', Verdana, Sans !important;
font-size: 14px !important;
}
.small {
font-size: 12px !important;
footer {
color: white;
}
footer a, footer a:visited, footer a:hover {
color: white;
}
.web-footer-menu ul li {
border-right: 1px solid white;
}
h1, h2, h3, h4, h5 {
font-family: 'Arial', Arial, 'Helvetica Neue' !important;
}
/* User CSS */
hr {
clear: both;
}
p {
margin-top: 2px;
}
.hand {
font-family: Pacifico;
font-size: 18px;
}
h1.top {
text-align: center;
}
.sub-head {
text-align: center;
color: #888;
font-size: 18px;
margin: 10px 0px;
}
.layout-main, .layout-main-section {
padding: 50px;
}
.layout-main-section {
width: 60%;
}
.layout-side-section {
padding-top: 50px;
}
h2 {
//font-family: Pacifico;
font-size: 20px;
font-weight: bold;
color: #CC0000;
padding: 25px 0px 25px 0px;
clear: both;
text-align: left;
}
.center {
text-align: center;
}
.left {
width: 375px;
padding-right: 25px;
float: left;
}
.right {
width: 375px;
padding-left: 25px;
float: left;
}
.page-footer {
clear: both;
margin: -50px;
margin-top: 50px;
background-color: #FFFAED;
padding: 50px;
}
.page-footer input {
width: 140px;
font-size: 17px;
padding: 4px;
margin-top: 2px;
}
.page-footer .section-head {
padding: 0px;
margin-bottom: 7px;
}
.green {
color: green;
}
.web-form input, .web-form textarea {
width: 400px;
font-size: 17px;
padding: 4px;
}
.link-big {
font-size: 140%;
}
.sticky {
background-color: #F0EDDD;
padding: 15px;
margin-left: 15px;
font-size: 12px;
color: #444;
width: 240px;
min-height: 120px;
float: right;
box-shadow: 2px 2px 6px #973;
}

View File

@ -494,11 +494,11 @@ return(hh.length==1?'0'+hh:hh)+':'+(mm.length==1?'0'+mm:mm);}}
wn.datetime.only_date=function(val){if(val==null||val=='')return null;if(val.search(':')!=-1){var tmp=val.split(' ');var d=tmp[0].split('-');}else{var d=val.split('-');}
if(d.length==3)
val=d[2]+'-'+d[1]+'-'+d[0];return val;}
wn.datetime.time_to_ampm=function(v){if(!v){var d=new Date();var t=[d.getHours(),cint(d.getMinutes()/5)*5]}else{var t=v.split(':');}
wn.datetime.time_to_ampm=function(v){if(!v){var d=new Date();var t=[d.getHours(),cint(d.getMinutes()/5)*5+'']}else{var t=v.split(':');}
if(t.length!=2){show_alert('[set_time] Incorect time format');return;}
if(cint(t[0])==0)var ret=['12',t[1],'AM'];else if(cint(t[0])<12)var ret=[cint(t[0])+'',t[1],'AM'];else if(cint(t[0])==12)var ret=['12',t[1],'PM'];else var ret=[(cint(t[0])-12)+'',t[1],'PM'];return ret;}
wn.datetime.time_to_hhmm=function(hh,mm,am){if(am=='AM'&&hh=='12'){hh='00';}else if(am=='PM'&&hh!='12'){hh=cint(hh)+12;}
return hh+':'+mm;}
if(!mm)mm='00';if(!hh)hh='00';return hh+':'+mm;}
function prettyDate(time){if(!time)return''
var date=time;if(typeof(time)=="string")
date=new Date((time||"").replace(/-/g,"/").replace(/[TZ]/g," ").replace(/\.[0-9]*/,""));var diff=(((new Date()).getTime()-date.getTime())/1000),day_diff=Math.floor(diff/86400);if(isNaN(day_diff)||day_diff<0)
@ -712,7 +712,7 @@ me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt
me.last_value=val;me.run_trigger();}
this.input.set_input=function(val){if(val==null)val='';me.input.value=val;if(me.format_input)me.format_input();}
if(this.df.options=='Suggest'){if(this.suggest_icon)$di(this.suggest_icon);$(me.input).autocomplete({source:function(request,response){wn.call({method:'webnotes.widgets.search.search_link',args:{'txt':request.term,'dt':me.df.options,'query':repl('SELECT DISTINCT `%(fieldname)s` FROM \
`tab%(dt)s` WHERE `%(fieldname)s` LIKE "%s" LIMIT 50',{fieldname:me.df.fieldname,dt:me.df.parent})},callback:function(r){response(r.results);}});}});}}
`tab%(dt)s` WHERE `%(fieldname)s` LIKE "%s" LIMIT 50',{fieldname:me.df.fieldname,dt:me.df.parent})},callback:function(r){response(r.results);}});},select:function(event,ui){me.set(ui.item.value);}});}}
DataField.prototype.validate=function(v){if(this.df.options=='Phone'){if(v+''=='')return'';v1=''
v=v.replace(/ /g,'').replace(/-/g,'').replace(/\(/g,'').replace(/\)/g,'');if(v&&v.substr(0,1)=='+'){v1='+';v=v.substr(1);}
if(v&&v.substr(0,2)=='00'){v1+='00';v=v.substr(2);}
@ -1550,7 +1550,7 @@ me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt
me.last_value=val;me.run_trigger();}
this.input.set_input=function(val){if(val==null)val='';me.input.value=val;if(me.format_input)me.format_input();}
if(this.df.options=='Suggest'){if(this.suggest_icon)$di(this.suggest_icon);$(me.input).autocomplete({source:function(request,response){wn.call({method:'webnotes.widgets.search.search_link',args:{'txt':request.term,'dt':me.df.options,'query':repl('SELECT DISTINCT `%(fieldname)s` FROM \
`tab%(dt)s` WHERE `%(fieldname)s` LIKE "%s" LIMIT 50',{fieldname:me.df.fieldname,dt:me.df.parent})},callback:function(r){response(r.results);}});}});}}
`tab%(dt)s` WHERE `%(fieldname)s` LIKE "%s" LIMIT 50',{fieldname:me.df.fieldname,dt:me.df.parent})},callback:function(r){response(r.results);}});},select:function(event,ui){me.set(ui.item.value);}});}}
DataField.prototype.validate=function(v){if(this.df.options=='Phone'){if(v+''=='')return'';v1=''
v=v.replace(/ /g,'').replace(/-/g,'').replace(/\(/g,'').replace(/\)/g,'');if(v&&v.substr(0,1)=='+'){v1='+';v=v.substr(1);}
if(v&&v.substr(0,2)=='00'){v1+='00';v=v.substr(2);}

View File

@ -381,11 +381,11 @@ return(hh.length==1?'0'+hh:hh)+':'+(mm.length==1?'0'+mm:mm);}}
wn.datetime.only_date=function(val){if(val==null||val=='')return null;if(val.search(':')!=-1){var tmp=val.split(' ');var d=tmp[0].split('-');}else{var d=val.split('-');}
if(d.length==3)
val=d[2]+'-'+d[1]+'-'+d[0];return val;}
wn.datetime.time_to_ampm=function(v){if(!v){var d=new Date();var t=[d.getHours(),cint(d.getMinutes()/5)*5]}else{var t=v.split(':');}
wn.datetime.time_to_ampm=function(v){if(!v){var d=new Date();var t=[d.getHours(),cint(d.getMinutes()/5)*5+'']}else{var t=v.split(':');}
if(t.length!=2){show_alert('[set_time] Incorect time format');return;}
if(cint(t[0])==0)var ret=['12',t[1],'AM'];else if(cint(t[0])<12)var ret=[cint(t[0])+'',t[1],'AM'];else if(cint(t[0])==12)var ret=['12',t[1],'PM'];else var ret=[(cint(t[0])-12)+'',t[1],'PM'];return ret;}
wn.datetime.time_to_hhmm=function(hh,mm,am){if(am=='AM'&&hh=='12'){hh='00';}else if(am=='PM'&&hh!='12'){hh=cint(hh)+12;}
return hh+':'+mm;}
if(!mm)mm='00';if(!hh)hh='00';return hh+':'+mm;}
function prettyDate(time){if(!time)return''
var date=time;if(typeof(time)=="string")
date=new Date((time||"").replace(/-/g,"/").replace(/[TZ]/g," ").replace(/\.[0-9]*/,""));var diff=(((new Date()).getTime()-date.getTime())/1000),day_diff=Math.floor(diff/86400);if(isNaN(day_diff)||day_diff<0)

View File

@ -70,7 +70,7 @@ me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt
me.last_value=val;me.run_trigger();}
this.input.set_input=function(val){if(val==null)val='';me.input.value=val;if(me.format_input)me.format_input();}
if(this.df.options=='Suggest'){if(this.suggest_icon)$di(this.suggest_icon);$(me.input).autocomplete({source:function(request,response){wn.call({method:'webnotes.widgets.search.search_link',args:{'txt':request.term,'dt':me.df.options,'query':repl('SELECT DISTINCT `%(fieldname)s` FROM \
`tab%(dt)s` WHERE `%(fieldname)s` LIKE "%s" LIMIT 50',{fieldname:me.df.fieldname,dt:me.df.parent})},callback:function(r){response(r.results);}});}});}}
`tab%(dt)s` WHERE `%(fieldname)s` LIKE "%s" LIMIT 50',{fieldname:me.df.fieldname,dt:me.df.parent})},callback:function(r){response(r.results);}});},select:function(event,ui){me.set(ui.item.value);}});}}
DataField.prototype.validate=function(v){if(this.df.options=='Phone'){if(v+''=='')return'';v1=''
v=v.replace(/ /g,'').replace(/-/g,'').replace(/\(/g,'').replace(/\)/g,'');if(v&&v.substr(0,1)=='+'){v1='+';v=v.substr(1);}
if(v&&v.substr(0,2)=='00'){v1+='00';v=v.substr(2);}

View File

@ -1,121 +1 @@
window.home_page = "home";
// footer signup widget
// automatically adds it to the .layout-main div of the page
// adds events and also random goodies.
erpnext.set_request_signup = function(page_name) {
// goodies
var goodies = [
"ERPNext also contains a module to build your website. \
The way it works is, when you log out, the app becomes your website. \
This website is generated from ERPNext.",
"You can add custom fields to your transactions in ERPNext to \
capture specific information about your business.",
"All forms in ERPNext can be customized, if you feel there are \
features you do not want to use, you can hide them.",
"You can email transactions like Quotations and Invoices directly \
from the system. You can also set this process to become automatic",
"You can create your own Roles and assign user to those roles. \
You can also set detailed permissions for each role in transactions.",
"ERPNext allows you to assign any transaction like an Invoice \
or Customer Issue to a user. You can also add comments on any \
transaction.",
"Stay on top with a daily, weekly or montly email summarizing all your business\
activites and accounting data like Income, Receivables, Paybles etc.",
"Integrate incoming Support queries to your email into ERPNext. \
Keep track of open tickets and allocate tickets to your users."
];
// add the footer
$('#page-' + page_name + ' .layout-main').append('<div class="page-footer">\
<h2 style="padding: 0px">Try before you buy. \
Request a 30-day Free Trial.</h2>\
<ul>\
<li><a href="erpnext-pricing.html">Starts at an un-believable $299 per year.</a>\
<li><a href="http://demo.erpnext.com" target="_blank">\
Show me a full demo (new page).</a>\
<li><a href="sign-up.html">Take me to the sign-up page.</a>\
</ul>\
<p>\
<i class="icon-hand-right"></i> <b>ERPNext Goodies:</b> <span class="goodie">'
+ goodies[parseInt(Math.random() * goodies.length)]+
'</goodie></p>\
<p>ERPNext is <a href="open-source.html">Open Source</a> under the GNU/General Public License.</p>\
<p><g:plusone size="medium" annotation="inline"></g:plusone></p>\
\
<table><tr><td style="width: 115px">\
<a href="https://twitter.com/erpnext" class="twitter-follow-button" \
data-show-count="false">Follow @erpnext</a></td>\
<td style="width: 150px; font-size: 80%; vertical-align: middle;">\
Get status updates on Twitter.</td></tr>\
</table>');
// render plusone
window.gapi && window.gapi.plusone.go();
// render twitter button
twttr.widgets.load();
}
//////////////// Hide Login for frappe!
$(document).ready(function() {
setTimeout("$('#login-topbar-item').toggle(false);", 1000);
});
//////////////// Analytics
window._gaq = window._gaq || [];
window._gaq.push(['_setAccount', 'UA-8911157-1']);
window._gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
/////////////// Page view
$(window).bind('hashchange', function() {
window._gaq.push(['_trackPageview', wn.get_route_str()]);
});
/////////////// Update conversion
erpnext.update_conversion = function() {
$('body').append('<div style="display:inline;">\
<img height="1" width="1" style="border-style:none;" alt="" \
src="http://www.googleadservices.com/pagead/conversion/1032834481/?label=JvAUCLX41gEQsZu_7AM&amp;guid=ON&amp;script=0"/>\
</div>')
};
////////////// Plus One
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
////////////// Twitter
(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){js=d.createElement(s);js.id=id;
js.src="//platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);}})(document,"script","twitter-wjs");