Merge branch 'master' of github.com:webnotes/erpnext into renamedt

This commit is contained in:
Nabin Hait 2012-03-28 16:17:53 +05:30
commit 6370ba8280
52 changed files with 798 additions and 558 deletions

View File

@ -134,6 +134,16 @@
'to_field': 'serial_no'
},
# Field Mapper Detail
{
'checking_operator': u'=',
'doctype': u'Field Mapper Detail',
'from_field': u'export_rate',
'map': u'Yes',
'match_id': 1,
'to_field': u'export_rate'
},
# Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
@ -143,17 +153,6 @@
'validation_logic': 'docstatus=1'
},
# Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
'from_field': 'delivery_note_details',
'from_table': 'Delivery Note Detail',
'match_id': 1,
'to_field': 'entries',
'to_table': 'RV Detail',
'validation_logic': 'amount > ifnull(billed_amt, 0) and docstatus = 1'
},
# Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
@ -186,4 +185,4 @@
'to_table': 'Sales Team',
'validation_logic': 'name is not null'
}
]
]

View File

@ -136,6 +136,16 @@
'to_field': 'incentives'
},
# Field Mapper Detail
{
'checking_operator': u'=',
'doctype': u'Field Mapper Detail',
'from_field': u'export_rate',
'map': u'Yes',
'match_id': 1,
'to_field': u'export_rate'
},
# Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
@ -188,4 +198,4 @@
'to_table': 'Sales Team',
'validation_logic': 'name is not null'
}
]
]

View File

@ -3,25 +3,26 @@
# These values are common in all dictionaries
{
'creation': '2011-10-19 14:27:47',
'creation': '2011-12-21 11:08:55',
'docstatus': 0,
'modified': '2011-10-19 14:29:45',
'modified_by': 'Administrator',
'owner': 'Administrator'
'modified': '2012-03-20 12:29:49',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Print Format
{
'doc_type': u'Receivable Voucher',
'doctype': 'Print Format',
'html': '<html>\n<head>\n<!--Other charges function-->\n<script>\n var make_row = function(title,val,bold){\n var bstart = \'<b>\'; var bend = \'</b>\';\n return \'<tr><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n +\'<td style="width:20%">\'+doc.currency+\'</td>\'\n +\'<td style="width:30%;text-align:right">\'+(val?val:\'0.00\')+\'</td>\'\n +\'</tr>\'\n }\n var make_row1 = function(title,val,bold){\n var bstart = \'<b>\'; var bend = \'</b>\';\n \n return \'<tr style="font-family:courier new; line-height:150%"><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n +\'<td style="width:50%;text-align:right">\'+(bold?bstart:\'\')+(val?val:\'0.00\')+(bold?bend:\'\')+\'</td>\'\n +\'</tr>\'\n }\n\nfunction get_letter_head() {\n\t// add letter head\n\tvar cp = locals[\'Control Panel\'][\'Control Panel\'];\n\tif(doc.letter_head)\n\t\tvar lh= cstr(_p.letter_heads[doc.letter_head]);\n\telse if(cp.letter_head)\n\t\tvar lh= cp.letter_head;\n\telse \n\t\tvar lh= \'\';\n\t\t\n\treturn lh;\n}\n\n function get_tax_details(){\n \n var cl = getchildren(\'RV Tax Detail\',doc.name,\'other_charges\');\n var out = \'\';\n\n// if(cl.length){\n out += \'<div><table style="float: right;">\';\n for(var i=0;i<cl.length;i++){\n out += make_row1(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);\n }\n\n out += make_row1(\'TOTAL\',fmt_money(doc.grand_total),1);\n // }\n out +=\'</table></div>\';\n return out;\n }\n function get_other_charges(){\n var out =\'\';\n out += \'<div><table cssClass="noborder" style="width:100%">\';\n \n out += make_row(\'Net Total\',fmt_money(convert_rate(doc.net_total)),1)\n +make_row(\'Total Taxes\',fmt_money(convert_rate(doc.other_charges_total)),0)\n +make_row(\'Grand Total\',fmt_money(convert_rate(doc.grand_total)),1)\n +make_row(\'Rounded Total\',fmt_money(convert_rate(doc.rounded_total)),1)\n +make_row(\'Outstanding Amount\',fmt_money(convert_rate(doc.outstanding_amount)),1)\n out += \'</table></div>\';\n return out;\n }\n\n \n function convert_rate(val){ \n var new_val = flt(val)/flt(doc.conversion_rate);\n return new_val;\n }\n \n</script>\n</head>\n<body>\n\n<div><script>get_letter_head()</script></div>\n<table width="100%" style="font-family: courier new; line-height:200%">\n<tr>\n<td align="left">NO: <script>doc.name</script></td>\n<td align="right">DATE: <script>date.str_to_user(doc.voucher_date)</script></td>\n</tr>\n<tr>\n<td>M/s <script>doc.contact_display</script></td>\n</tr>\n</table>\n<!--Item Table-->\n<div>\n <script>\n var t = print_table(\'Receivable Voucher\', doc.name, \'entries\', \'RV Detail\', [\'description\',\'qty\',\'basic_rate\',\'amount\'], [\'ITEM\', \'QTY\',\'RATE\',\'AMOUNT\'], [\'35%\',\'20%\',\'20%\',\'25%\'])\n if(t.appendChild) {\n // single\n out = t.innerHTML.replace(/border: 1px/gi,\'border: 0px\').replace(/style="/gi,\'style="font-family:courier new;line-height:150%;\');\n }\n else {//multiple\n out = \'<table class="None" border="0px" width="100%" style="border:0px; font-family:courier-new">\';\n\n for(var i=0;i<t.length;i++) \n {\n\t\tif(i==0)\n\t\t{\n\t\t\tout+=\'<tr>\'+t[i].childNodes[0].childNodes[0].childNodes[0].innerHTML.replace(/style="border: 1px solid rgb\\(0, 0, 0\\);/gi,\'style="font-family:courier new;\')+\'</tr>\'\n\t\t}\n\t\tout+=\'<tr>\'+t[i].childNodes[0].childNodes[0].childNodes[1].innerHTML.replace(/style="border: 1px solid rgb\\(0, 0, 0\\);/gi,\'style="font-family:courier new;\')+\'</tr>\'\n }\n\tout += \'</table>\'\n }\n out;\n </script>\n\n</div>\n\n<!--Tax table-->\n<div><script>get_tax_details();</script>\n </table>\n</div>\n\n<br>\n<table style="font-family:courier new;">\n<tr><td><b><script>doc.terms</script></b></td></tr>\n<tr><td nowrap><b>For <script>doc.company</script></b></td></tr>\n<tr><td>&nbsp;</td></tr>\n<tr><td nowrap><b>Signatory</b></td></tr>\n</table>\n</body>\n</html>',
'module': 'Accounts',
'html': u'<html>\n<head>\n<!--Other charges function-->\n<script>\nvar make_row = function(title,val,bold){\nvar bstart = \'<b>\'; var bend = \'</b>\';\nreturn \'<tr><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n +\'<td style="width:20%">\'+doc.currency+\'</td>\'\n +\'<td style="width:30%;text-align:right">\'+(val?val:\'0.00\')+\'</td>\'\n +\'</tr>\'\n}\nvar make_row1 = function(title,val,bold){\n var bstart = \'<b>\'; var bend = \'</b>\';\n \n return \'<tr style="font-family:courier new; line-height:150%"><td style="width:50%">\'+(bold?bstart:\'\')+title+(bold?bend:\'\')+\'</td>\'\n +\'<td style="width:50%;text-align:right">\'+(bold?bstart:\'\')+(val?val:\'0.00\')+(bold?bend:\'\')+\'</td>\'\n +\'</tr>\'\n}\n\nfunction get_letter_head() {\n // add letter head\n var cp = wn.boot.control_panel;\n if(doc.letter_head)\n var lh= cstr(_p.letter_heads[doc.letter_head]);\n else if(cp.letter_head)\n var lh= cp.letter_head;\n else \n var lh= \'\';\n \n return lh;\n}\n\nfunction get_tax_details(){\n var cl = getchildren(\'RV Tax Detail\',doc.name,\'other_charges\');\n var out = \'\';\n\n out += \'<div><table style="float: right;">\';\n for(var i=0;i<cl.length;i++){\n if(cl[i].tax_amount) {\n out += make_row1(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);\n }\n }\n out += make_row1(\'TOTAL\',doc.currency + " " + fmt_money(convert_rate(doc.grand_total)),1);\n out +=\'</table></div>\';\n return out;\n}\n\nfunction convert_rate(val){ \n var new_val = flt(val)/flt(doc.conversion_rate);\n return new_val;\n}\n</script>\n<style>\n table, td, tr, div, span {\n font-family: courier new;\n line-height: 200%;\n }\n</style>\n</head>\n\n<body>\n<table width="100%" style="font-family: courier new; line-height:200%">\n<tr>\n <td align="left">NO: <script>doc.name</script></td>\n <td align="right">DATE: <script>date.str_to_user(doc.posting_date)</script></td>\n</tr>\n<tr>\n <td>M/s <script>doc.contact_display</script></td>\n</tr>\n</table>\n<!--Item Table-->\n<div>\n<script>\nvar t = print_table(\'Receivable Voucher\', doc.name, \'entries\', \'RV Detail\',\n [\'description\',\'qty\',\'export_rate\',\'export_amount\'], [\'ITEM\', \'QTY\',\'RATE\',\'AMOUNT\'],\n [\'35%\',\'20%\',\'20%\',\'25%\']);\nif(t.appendChild) { // single\n out = t.innerHTML.replace(/style="/gi,\'style="font-family:courier new;line-height:150%;\');\n} else { //multiple\n out = \'<table class="None" border="0px" width="100%" style="border:0px; font-family:courier-new">\';\n\n for(var i=0;i<t.length;i++) {\n if(i==0) {\n out += \'<tr>\' + t[i].childNodes[0].childNodes[0].childNodes[0].innerHTML\n .replace(/style="border: 1px solid rgb\\(0, 0, 0\\);/gi,\'style="font-family:courier new;\')\n + \'</tr>\';\n }\n out += \'<tr>\' + t[i].childNodes[0].childNodes[0].childNodes[1].innerHTML\n .replace(/style="border: 1px solid rgb\\(0, 0, 0\\);/gi,\'style="font-family:courier new;\')\n + \'</tr>\';\n }\n out += \'</table>\';\n}\nout;\n</script>\n</div>\n<!--Tax table-->\n<div><script>get_tax_details();</script></div><br />\n<table style="font-family:courier new;">\n <tr><td><b><script>doc.terms</script></b></td></tr>\n <tr><td nowrap><b>For <script>doc.company</script></b></td></tr>\n <tr><td>&nbsp;</td></tr>\n <tr><td nowrap><b>Signatory</b></td></tr>\n</table>\n</body>\n</html>\n',
'module': u'Accounts',
'name': '__common__',
'standard': 'Yes'
'standard': u'Yes'
},
# Print Format, POS Invoice
{
'doctype': 'Print Format',
'name': 'POS Invoice'
'name': u'POS Invoice'
}
]

View File

@ -560,10 +560,12 @@ def send_notification(new_rv):
<table cellspacing= "5" cellpadding="5" width = "100%%">
<tr>
<td width = "50%%"><b>Customer</b><br>%s<br>%s</td>
<td width = "50%%">Invoice Date: %s<br>Due Date: %s</td>
<td width = "50%%">Invoice Date : %s<br>Invoice Period : %s to %s <br>Due Date : %s</td>
</tr>
</table>
''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, new_rv.doc.posting_date, new_rv.doc.due_date)
''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"), \
getdate(add_days(add_months(new_rv.doc.posting_date, -1), 1)).strftime("%d-%m-%Y"), getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"),\
getdate(new_rv.doc.due_date).strftime("%d-%m-%Y"))
tbl = '''<table border="1px solid #CCC" width="100%%" cellpadding="0px" cellspacing="0px">
@ -596,10 +598,10 @@ def send_notification(new_rv):
</table>
</td>
</tr>
<tr><td>Terms:</td></tr>
<tr><td>Terms and Conditions:</td></tr>
<tr><td>%s</td></tr>
</table>
''' % (new_rv.doc.net_total, new_rv.doc.total_tax,new_rv.doc.grand_total, new_rv.doc.in_words,new_rv.doc.terms)
''' % (new_rv.doc.net_total, new_rv.doc.other_charges_total,new_rv.doc.grand_total, new_rv.doc.in_words,new_rv.doc.terms)
msg = hd + tbl + totals

View File

@ -162,7 +162,7 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) {
// Recalculate Button
// -------------------
cur_frm.cscript['Recalculate'] = function(doc, dt, dn) {
cur_frm.cscript['Recalculate'] = function(doc, cdt, cdn) {
cur_frm.cscript['Calculate Tax'](doc,cdt,cdn);
calc_total_advance(doc,cdt,cdn);
}
@ -254,7 +254,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
// Item Code
// ----------
cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.%(key)s LIKE "%s" LIMIT 50'
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'
}
// Credit To

View File

@ -123,7 +123,10 @@ class DocType(TransactionBase):
def get_pv_details(self, arg):
import json
item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center from tabItem where name=%s",arg,as_dict=1)
item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center, last_purchase_rate from tabItem where name=%s",arg,as_dict=1)
lpr = item_det and flt(item_det[0]['last_purchase_rate']) or 0
import_lpr = lpr / flt(self.doc.conversion_rate) or 1
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg)
t = {}
for x in tax: t[x[0]] = flt(x[1])
@ -132,13 +135,17 @@ class DocType(TransactionBase):
'brand' : item_det and item_det[0]['brand'] or '',
'description' : item_det and item_det[0]['description'] or '',
'item_group' : item_det and item_det[0]['item_group'] or '',
'rate' : 0.00,
'rate' : lpr,
'purchase_ref_rate' : lpr,
'import_ref_rate' : import_lpr,
'import_rate' : import_lpr,
'qty' : 0.00,
'amount' : 0.00,
'expense_head' : item_det and item_det[0]['purchase_account'] or '',
'cost_center' : item_det and item_det[0]['cost_center'] or '',
'item_tax_rate' : json.dumps(t)
}
return ret

View File

@ -162,14 +162,24 @@ cur_frm.cscript.warehouse = function(doc, cdt , cdn) {
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
var callback = function(r,rt) {
var callback2 = function(doc, dt, dn) {
doc = locals[dt][dn];
if(doc.debit_to && doc.posting_date){
get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1,
function(doc, dt, dn) {
cur_frm.refresh();
});
}
}
var doc = locals[cur_frm.doctype][cur_frm.docname];
get_server_fields('get_debit_to','','',doc, dt, dn, 0);
cur_frm.refresh();
get_server_fields('get_debit_to','','',doc, dt, dn, 0, callback2);
}
var args = onload ? 'onload':''
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', args, callback);
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
}

View File

@ -1,5 +1,5 @@
SELECT gl.account,sum(gl.credit) as amount
FROM `tabGL Entry` gl, `tabAccount` a
WHERE gl.account=a.name and a.master_type='Customer' and gl.posting_date between '%(date)s' and '%(date1)s'
WHERE gl.account=a.name and a.master_type='Customer' and gl.posting_date between '%(date)s' and '%(date1)s' and ifnull(gl.is_cancelled, 'No') = 'No'
GROUP BY gl.account
ORDER BY posting_date

View File

@ -114,8 +114,8 @@ for r in res:
r.append(flt(opening<0 and -opening or 0))
r.append(flt(debit))
r.append(flt(credit))
r.append(flt(closing>0 and closing or 0))
r.append(flt(closing<0 and -closing or 0))
r.append(flt(closing>0.01 and closing or 0))
r.append(flt(closing<-0.01 and -closing or 0))
out =[]

View File

@ -162,7 +162,11 @@ cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) {
//==================== Item Code Get Query =======================================================
// Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed.
cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes" or ifnull(tabItem.is_sub_contracted_item, "No")="Yes") AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.%(key)s LIKE "%s" LIMIT 50'
if (doc.is_subcontracted =="Yes") {
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE ifnull(tabItem.is_sub_contracted_item, "No")="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'
} else {
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE ifnull(tabItem.is_purchase_item, "No")="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'
}
}
//==================== Get Item Code Details =====================================================

View File

@ -69,14 +69,14 @@
}
/* Hover and click effects */
.case-border:hover, .circle:hover {
box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
.case-border:hover, .circle:hover, .hover-effect {
box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
-moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
-webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
-o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
}
.case-border:active, .case-border:focus, .circle:active, .circle:focus {
.case-border:active, .case-border:focus, .case-border-click {
transform: scale(0.98, 0.98);
-ms-transform: scale(0.98, 0.98); /* IE 9 */
-webkit-transform: scale(0.98, 0.98); /* Safari and Chrome */
@ -84,6 +84,14 @@
-moz-transform: scale(0.98, 0.98); /* Firefox */
}
.circle:active, .circle:focus, .circle-click {
transform: scale(1, 1);
-ms-transform: scale(1, 1); /* IE 9 */
-webkit-transform: scale(1, 1); /* Safari and Chrome */
-o-transform: scale(1, 1); /* Opera */
-moz-transform: scale(1, 1); /* Firefox */
}
.circle {
border-radius: 30px;
-moz-border-radius: 30px;
@ -93,9 +101,8 @@
min-width: 15px;
background: #B00D07;
padding: 3px;
z-index: 2;
float: right;
margin-top: -10px;
margin-top: -74px;
margin-right: 10px;
border: 2px solid white;
box-shadow: 0 0 10px 1px black;
@ -106,10 +113,8 @@
.circle-text {
color: white;
vertical-align: middle;
text-align: center;
display: inline-block;
margin-top: -3px;
text-shadow: 1px 1px 5px #000;
margin-top: 1px;
}

View File

@ -95,9 +95,37 @@ erpnext.desktop.render = function() {
}
erpnext.desktop.show_pending_notifications = function() {
$('#messages a:first').prepend('<div id="msg_count" class="circle" title="Unread Messages">\
<span class="circle-text"></span></div>');
$('#msg_count').toggle(false);
var add_circle = function(str_module, id, title) {
var module = $('#'+str_module);
module.find('a:first').append(
repl('<div id="%(id)s" class="circle" title="%(title)s" style="display: None">\
<span class="circle-text"></span>\
</div>', {id: id, title: title}));
var case_border = module.find('.case-border');
var circle = module.find('.circle');
var add_hover_and_click = function(primary, secondary, hover_class, click_class) {
primary
.hover(
function() { secondary.addClass(hover_class); },
function() { secondary.removeClass(hover_class); })
.mousedown(function() { secondary.addClass(click_class); })
.mouseup(function() { secondary.removeClass(click_class); })
.focusin(function() { $(this).mousedown(); })
.focusout(function() { $(this).mouseup(); })
}
add_hover_and_click(case_border, circle, 'hover-effect', 'circle-click');
add_hover_and_click(circle, case_border, 'hover-effect', 'case-border-click');
}
add_circle('messages', 'unread_messages', 'Unread Messages');
add_circle('support', 'open_support_tickets', 'Open Support Tickets');
add_circle('todo', 'things_todo', 'Things To Do');
add_circle('calendar', 'todays_events', 'Todays Events');
update_messages();
}

View File

@ -600,7 +600,7 @@ pscript.home_make_status = function() {
// get values
$c_page('home', 'event_updates', 'get_status_details', user,
function(r,rt) {
page_body.wntoolbar.set_new_comments(r.message.unread_messages);
//page_body.wntoolbar.set_new_comments(r.message.unread_messages);
// render online users
pscript.online_users_obj.render(r.message.online_users);

View File

@ -26,8 +26,7 @@ def get_online_users(arg=None):
and t1.user not in ('Guest','Administrator')
and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or []
@webnotes.whitelist()
def get_unread_messages(arg=None):
def get_unread_messages():
"returns unread (docstatus-0 messages for a user)"
return webnotes.conn.sql("""\
SELECT name, comment
@ -37,6 +36,49 @@ def get_unread_messages(arg=None):
AND ifnull(docstatus,0)=0
""", webnotes.user.name, as_list=1)
def get_open_support_tickets():
"""
Returns a count of open support tickets
"""
from webnotes.utils import cint
open_support_tickets = webnotes.conn.sql("""\
SELECT COUNT(*) FROM `tabSupport Ticket`
WHERE status = 'Open'""")
return open_support_tickets and cint(open_support_tickets[0][0]) or 0
def get_things_todo():
"""
Returns a count of incomplete todos
"""
from webnotes.utils import cint
incomplete_todos = webnotes.conn.sql("""\
SELECT COUNT(*) FROM `tabToDo Item`
WHERE IFNULL(checked, 0) = 0
AND owner = %s""", webnotes.session.get('user'))
return incomplete_todos and cint(incomplete_todos[0][0]) or 0
def get_todays_events():
"""
Returns a count of todays events in calendar
"""
from webnotes.utils import nowdate, cint
todays_events = webnotes.conn.sql("""\
SELECT COUNT(*) FROM `tabEvent`
WHERE owner = %s
AND event_type != 'Cancel'
AND event_date = %s""", (
webnotes.session.get('user'), nowdate()))
return todays_events and cint(todays_events[0][0]) or 0
@webnotes.whitelist()
def get_global_status_messages(arg=None):
return {
'unread_messages': get_unread_messages(),
'open_support_tickets': get_open_support_tickets(),
'things_todo': get_things_todo(),
'todays_events': get_todays_events(),
}
@webnotes.whitelist()
def get_status_details(arg=None):
"""get toolbar items"""
@ -47,7 +89,8 @@ def get_status_details(arg=None):
# system messages
ret = {
'user_count': len(online) or 0,
'unread_messages': get_unread_messages(),
#'unread_messages': get_unread_messages(),
#'open_support_tickets': get_open_support_tickets(),
'online_users': online or [],
'setup_status': get_setup_status(),
'registration_complete': cint(get_defaults('registration_complete')) and 'Yes' or 'No',

View File

@ -0,0 +1,3 @@
def execute():
import webnotes
webnotes.conn.sql("delete from `tabTable Mapper Detail` where to_table = 'RV Detail' and parent = 'Delivery Note-Receivable Voucher' and validation_logic = 'amount > ifnull(billed_amt, 0) and docstatus = 1'")

View File

@ -0,0 +1,9 @@
def execute():
import webnotes
from webnotes.modules.module_manager import reload_doc
reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note')
reload_doc('accounts', 'DocType Mapper', 'Sales Order-Receivable Voucher')
reload_doc('accounts', 'DocType Mapper', 'Delivery Note-Receivable Voucher')
webnotes.conn.sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'basic_rate' and to_field = 'basic_rate'")

View File

@ -0,0 +1,4 @@
def execute():
import webnotes
from webnotes.modules.module_manager import reload_doc
reload_doc('selling', 'doctype', 'quotation')

View File

@ -0,0 +1,6 @@
def execute():
import webnotes
from webnotes.modules.module_manager import reload_doc
reload_doc('stock', 'doctype', 'stock_entry')
webnotes.conn.sql("update `tabDocField` set options = concat(options, '\nOthers') where fieldname = 'purpose' and parent = 'Stock Entry'")

View File

@ -0,0 +1,3 @@
def execute():
import webnotes
webnotes.conn.sql("update `tabDocField` set options = replace(options, 'Others', 'Other') where fieldname = 'purpose' and parent = 'Stock Entry'")

View File

@ -0,0 +1,6 @@
def execute():
import webnotes
webnotes.conn.sql("update `tabDocField` set options = 'Bill Of Materials' where fieldname = 'bom_no' and parent = 'Stock Entry'")
from webnotes.modules.module_manager import reload_doc
reload_doc('stock', 'doctype', 'stock_entry')

View File

View File

@ -0,0 +1,5 @@
def execute():
import webnotes
webnotes.conn.sql("DELETE FROM `tabDocFormat` WHERE format='POS Invoice'")
from webnotes.modules.module_manager import reload_doc
reload_doc('accounts', 'Print Format', 'POS Invoice')

View File

@ -187,5 +187,35 @@ patch_list = [
'patch_file': 'update_stockreco_perm',
'description': 'Update stock reco permission'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'stock_entry_others_patch',
'description': 'new purpose others in stock entry'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'reload_quote',
'description': 'reload quote: organization fld added'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'update_purpose_se',
'description': 'Purpose SE: Others to Other'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'update_se_fld_options',
'description': 'Purpose SE: Others to Other'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'reload_mapper',
'description': 'SO-DN, SO-Rv, DN-RV'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'mapper_fix',
'description': 'DN-RV duplicate table entry'
},
]

View File

@ -203,7 +203,7 @@
# DocField
{
'colour': u'White:FFF',
'description': u'<a href="javascript:cur_frm.cscript.CGHelp();">To manage Customer Groups, click here</a>',
'description': u'<a href="#!Sales Browser/Customer Group">To manage Customer Groups, click here</a>',
'doctype': u'DocField',
'fieldname': u'customer_group',
'fieldtype': u'Link',
@ -223,7 +223,7 @@
# DocField
{
'colour': u'White:FFF',
'description': u'<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>',
'description': u'<a href="#!Sales Browser/Territory">To manage Territory, click here</a>',
'doctype': u'DocField',
'fieldname': u'territory',
'fieldtype': u'Link',

View File

@ -41,7 +41,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(doc.quotation_to) {
if(doc.quotation_to == 'Customer') {
hide_field(['lead', 'lead_name']);
hide_field(['lead', 'lead_name', 'organization']);
}
else if (doc.quotation_to == 'Lead') {
hide_field(['customer','customer_address','contact_person', 'customer_name','contact_display', 'customer_group']);
@ -60,16 +60,11 @@ cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
// hide - unhide fields based on lead or customer..
// =======================================================================================================================
cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
if(doc.quotation_to == 'Lead'){
unhide_field(['lead']);
hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
}
else if(doc.quotation_to == 'Customer'){
unhide_field(['customer']);
hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
}
hide_field(['lead', 'lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group', 'organization']);
if(doc.quotation_to == 'Lead') unhide_field(['lead']);
else if(doc.quotation_to == 'Customer') unhide_field(['customer']);
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = doc.organization = "";
}
@ -140,7 +135,7 @@ cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
cur_frm.cscript.lead = function(doc, cdt, cdn) {
if(doc.lead) get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1);
if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);
if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory', 'organization']);
}

View File

@ -116,26 +116,8 @@ class DocType(TransactionBase):
# Pull details from other charges master (Get Other Charges)
# ----------------------------------------------------------
def get_other_charges(self):
return get_obj('Sales Common').get_other_charges(self)
return get_obj('Sales Common').get_other_charges(self)
# Get Lead Details along with its details
# ==============================================================
def get_lead_details1(self, name):
details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1)
ret = {
'lead_name' : details and details[0]['lead_name'] or '',
'address_display' : (details and details[0]['address_line1']
+ (details[0]['address_line2'] and '\n' + details[0]['address_line2'] or '') + '\n'
+ details[0]['city']
+ (details[0]['pincode'] and ', ' + details[0]['pincode'] or '') + '\n'
+ (details[0]['state'] and details[0]['state']+', ' or '')
+ details[0]['country'] + '\nTel: ' + details[0]['contact_no'] + '\n' or '-'),
'territory' : details and details[0]['territory'] or '',
'contact_mobile' : details and details[0]['mobile_no'] or '-',
'contact_email' : details and details[0]['email_id'] or '-'
}
return ret
# GET TERMS AND CONDITIONS
# ====================================================================================

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:17',
'docstatus': 0,
'modified': '2012-03-02 12:20:40',
'modified': '2012-03-20 14:56:28',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -21,7 +21,7 @@
# These values are common for all DocType
{
'_last_update': u'1330069750',
'_last_update': u'1332235370',
'allow_attach': 1,
'allow_email': 0,
'allow_trash': 1,
@ -41,7 +41,7 @@
'show_in_menu': 0,
'subject': u'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
'tag_fields': u'status',
'version': 618
'version': 621
},
# These values are common for all DocFormat
@ -292,6 +292,15 @@
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'organization',
'fieldtype': u'Data',
'label': u'Organization',
'permlevel': 1
},
# DocField
{
'colour': u'White:FFF',
@ -385,7 +394,7 @@
'oldfieldtype': u'Select',
'options': u'\nSales\nMaintenance',
'permlevel': 0,
'print_hide': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 0
},

View File

@ -209,13 +209,14 @@ class DocType(TransactionBase):
if default: add_cond = 'ifnull(t2.is_default,0) = 1'
else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
idx = 0
other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center_other_charges from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
for other in other_charge:
d = addchild(obj.doc, 'other_charges', 'RV Tax Detail', 1, obj.doclist)
d.charge_type = other['charge_type']
d.row_id = other['row_id']
d.description = other['description']
d.account_head = other['account_head']
d.cost_center_other_charges = other['cost_center_other_charges']
d.rate = flt(other['rate'])
d.tax_amount = flt(other['tax_amount'])
d.included_in_print_rate = cint(other['included_in_print_rate'])
@ -514,7 +515,7 @@ class DocType(TransactionBase):
dt = webnotes.conn.sql("select posting_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
else:
dt = webnotes.conn.sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or ''
d.prevdoc_date = (dt and dt[0][0]) and dt[0][0].strftime('%Y-%m-%d') or ''
def update_prevdoc_detail(self, is_submit, obj):
StatusUpdater(obj, is_submit).update()

View File

@ -35,7 +35,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(!doc.price_list_currency) set_multiple(cdt, cdn, {price_list_currency: doc.currency, plc_conversion_rate: 1});
// load default charges
if(doc.__islocal){
if(doc.__islocal && !doc.customer){
hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
}
}
@ -100,13 +100,16 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
//customer
cur_frm.cscript.customer = function(doc,dt,dn) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0);
var callback2 = function(r, rt) {
if(doc.customer) unhide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory','customer_group','shipping_address']);
cur_frm.refresh();
}
var doc = locals[cur_frm.doctype][cur_frm.docname];
get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0, callback2);
}
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
if(doc.customer) unhide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory','customer_group','shipping_address']);
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {

View File

@ -231,7 +231,7 @@
'doctype': 'DocField',
'fieldtype': 'HTML',
'label': 'IGHelp',
'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Item Group\');">To manage Item Groups, click here</a>'
'options': '<a href="#!Sales Browser/Item Group">To manage Item Groups, click here</a>'
},
# DocField
@ -391,7 +391,7 @@
'doctype': 'DocField',
'fieldtype': 'HTML',
'label': 'CGHelp',
'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Customer Group\');">To manage Customer Groups, click here</a>'
'options': '<a href="#!Sales Browser/Customer Group">To manage Customer Groups, click here</a>'
},
# DocField
@ -408,7 +408,7 @@
'doctype': 'DocField',
'fieldtype': 'HTML',
'label': 'TerritoryHelp',
'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Territory\');">To manage Territory, click here</a>'
'options': '<a href="#!Sales Browser/Territory">To manage Territory, click here</a>'
},
# DocField

View File

@ -183,7 +183,7 @@
'idx': 5,
'label': 'SPHelp',
'oldfieldtype': 'HTML',
'options': '<a href="javascript:cur_frm.cscript.TreePage(\'Sales Person\');">To manage Sales Person, click here</a>',
'options': '<a href="#!Sales Browser/Sales Person">To manage Sales Person, click here</a>',
'permlevel': 0
},

View File

@ -87,6 +87,7 @@ def boot_session(bootinfo):
import webnotes.model.doctype
bootinfo['docs'] += webnotes.model.doctype.get('Event')
bootinfo['docs'] += webnotes.model.doctype.get('Search Criteria')
bootinfo['modules_list'] = webnotes.conn.get_global('modules_list')

View File

@ -110,20 +110,29 @@ var update_messages = function(reset) {
if(inList(['Guest'], user)) { return; }
if(!reset) {
$c_page('home', 'event_updates', 'get_unread_messages', null,
$c_page('home', 'event_updates', 'get_global_status_messages', null,
function(r,rt) {
if(!r.exc) {
// This function is defined in toolbar.js
page_body.wntoolbar.set_new_comments(r.message);
var circle = $('#msg_count')
if(circle) {
if(r.message.length) {
circle.find('span:first').text(r.message.length);
circle.toggle(true);
} else {
circle.toggle(false);
page_body.wntoolbar.set_new_comments(r.message.unread_messages);
var show_in_circle = function(parent_id, msg) {
var parent = $('#'+parent_id);
if(parent) {
if(msg) {
parent.find('span:first').text(msg);
parent.toggle(true);
} else {
parent.toggle(false);
}
}
}
show_in_circle('unread_messages', r.message.unread_messages.length);
show_in_circle('open_support_tickets', r.message.open_support_tickets);
show_in_circle('things_todo', r.message.things_todo);
show_in_circle('todays_events', r.message.todays_events);
} else {
clearInterval(wn.updates.id);
}
@ -131,7 +140,7 @@ var update_messages = function(reset) {
);
} else {
page_body.wntoolbar.set_new_comments(0);
$('#msg_count').toggle(false);
$('#unread_messages').toggle(false);
}
}

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:35',
'docstatus': 0,
'modified': '2012-03-01 17:58:16',
'modified': '2012-03-20 14:24:12',
'modified_by': u'Administrator',
'owner': u'Administrator'
},

View File

@ -131,10 +131,10 @@
{
'checking_operator': u'=',
'doctype': u'Field Mapper Detail',
'from_field': u'basic_rate',
'from_field': u'export_rate',
'map': u'Yes',
'match_id': 1,
'to_field': u'basic_rate'
'to_field': u'export_rate'
},
# Field Mapper Detail
@ -264,4 +264,4 @@
'to_table': u'Delivery Note',
'validation_logic': u'docstatus = 1'
}
]
]

View File

@ -337,12 +337,12 @@ class DocType:
and t1.docstatus != 2
""", self.doc.item_code)
if ((flt(ret[0]['re_order_level']) > flt(current_qty)) and ret[0]['re_order_level']):
self.create_auto_indent(ret[0], doc_type, doc_name)
if ((flt(ret[0]['re_order_level']) > flt(current_qty[0][0])) and ret[0]['re_order_level']):
self.create_auto_indent(ret[0], doc_type, doc_name, current_qty[0][0])
def create_auto_indent(self, i , doc_type, doc_name):
def create_auto_indent(self, i , doc_type, doc_name, cur_qty):
""" Create indent on reaching reorder level """
indent = Document('Indent')
@ -361,7 +361,7 @@ class DocType:
indent_details_child.item_name = i['item_name']
indent_details_child.description = i['description']
indent_details_child.item_group = i['item_group']
indent_details_child.qty = i['re_order_qty']
indent_details_child.qty = i['re_order_qty'] or (flt(i['re_order_level']) - flt(cur_qty))
indent_details_child.brand = i['brand']
indent_details_child.save()
indent_obj = get_obj('Indent',indent.name,with_children=1)

View File

@ -81,11 +81,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.customer = function(doc,dt,dn,onload) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
cur_frm.refresh();
}
var args = onload ? 'onload':''
if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', args, callback);
if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']);
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {

View File

@ -31,11 +31,11 @@
'module': u'Stock',
'name': '__common__',
'read_only_onload': 1,
'search_fields': u'status,transaction_date,customer,customer_name, territory,grand_total',
'search_fields': u'status,customer,customer_name, territory,grand_total',
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
'subject': u'To %(customer_name)s on %(posting_date)s | %(per_billed)s% billed',
'tag_fields': u'billing_status',
'version': 475
},

View File

@ -21,11 +21,11 @@
'module': u'Stock',
'name': '__common__',
'read_only_onload': 1,
'search_fields': u'status, transaction_date, supplier',
'search_fields': u'status, posting_date, supplier',
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'From %(supplier_name)s against %(purchase_order)s on %(transaction_date)s',
'subject': u'From %(supplier_name)s against %(purchase_order)s on %(posting_date)s',
'version': 325
},

View File

@ -22,13 +22,17 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
var cfn_set_fields = function(doc, cdt, cdn) {
lst = ['supplier','supplier_name','supplier_address','customer','customer_name','customer_address'];
if (doc.purpose == 'Production Order'){
unhide_field(['production_order', 'process', 'Get Items']);
hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','Warehouse HTML']);
doc.from_warehouse = '';
lst = ['supplier','supplier_name','supplier_address','customer','customer_name','customer_address'];
hide_field(lst);
if (doc.purpose == 'Production Order' || doc.purpose == 'Other'){
unhide_field('Get Items');
hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','Warehouse HTML', 'transporter', 'is_excisable_goods', 'excisable_goods']);
if (doc.purpose=='Production Order') unhide_field(['production_order', 'process']);
doc.from_warehouse = '';
doc.to_warehosue = '';
if (doc.process == 'Backflush'){
if (doc.process == 'Backflush' || doc.purpose == 'Other'){
unhide_field('fg_completed_qty');
}
else{
@ -39,7 +43,6 @@ var cfn_set_fields = function(doc, cdt, cdn) {
else{
unhide_field(['from_warehouse', 'to_warehouse']);
hide_field(['production_order', 'process', 'Get Items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']);
hide_field(lst);
doc.production_order = '';
doc.process = '';
doc.fg_completed_qty = 0;
@ -48,12 +51,10 @@ var cfn_set_fields = function(doc, cdt, cdn) {
if(doc.purpose == 'Purchase Return'){
doc.customer=doc.customer_name = doc.customer_address=doc.delivery_note_no=doc.sales_invoice_no='';
hide_field(lst);
unhide_field(['supplier','supplier_name','supplier_address','purchase_receipt_no']);
}
else if(doc.purpose == 'Sales Return'){
doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no='';
hide_field(lst);
unhide_field(['customer','customer_name','customer_address','delivery_note_no', 'sales_invoice_no']);
} else{
doc.customer=doc.customer_name=doc.customer_address=doc.delivery_note_no=doc.sales_invoice_no=doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no='';
@ -110,6 +111,7 @@ fld.get_query = function(doc, cdt, cdn) {
+'AND ifnull(`tabBin`.`actual_qty`,0) > 0 '
+'AND tabBin.warehouse="'+ d.s_warehouse +'" '
+'AND tabItem.docstatus < 2 '
+'AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") '
+'AND tabItem.%(key)s LIKE "%s" '
+'ORDER BY tabItem.name ASC '
+'LIMIT 50'
@ -117,6 +119,7 @@ fld.get_query = function(doc, cdt, cdn) {
return 'SELECT tabItem.name, tabItem.description '
+'FROM tabItem '
+'WHERE tabItem.docstatus < 2 '
+'AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") '
+'AND tabItem.%(key)s LIKE "%s" '
+'ORDER BY tabItem.name ASC '
+'LIMIT 50'

View File

@ -157,13 +157,13 @@ class DocType:
def get_raw_materials(self,pro_obj):
def get_raw_materials(self, bom_no, fg_qty, consider_sa_items_as_rm):
"""
get all items from flat bom except
child items of sub-contracted and sub assembly items
and sub assembly items itself.
"""
if pro_obj.doc.consider_sa_items == 'Yes':
if consider_sa_items_as_rm == 'Yes':
# Get all raw materials considering SA items as raw materials,
# so no childs of SA items
fl_bom_sa_items = sql("""
@ -171,8 +171,7 @@ class DocType:
from `tabBOM Material`
where parent = '%s' and docstatus < 2
group by item_code
""" % ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) \
or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no)))
""" % (fg_qty, bom_no))
self.make_items_dict(fl_bom_sa_items)
@ -189,8 +188,7 @@ class DocType:
and ifnull(it.is_sub_contracted_item, 'No') = 'No' and fb.docstatus<2 and fb.parent=%s
) a
group by item_code,stock_uom
""" , ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) \
or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no)))
""" , (fg_qty, bom_no))
self.make_items_dict(fl_bom_sa_child_item)
# Update only qty remaining to be issued for production
@ -199,17 +197,11 @@ class DocType:
def add_to_stock_entry_detail(self, pro_obj, item_dict, fg_item = 0):
sw, tw = '', ''
if self.doc.process == 'Material Transfer':
tw = cstr(pro_obj.doc.wip_warehouse)
if self.doc.process == 'Backflush':
tw = fg_item and cstr(pro_obj.doc.fg_warehouse) or ''
if not fg_item: sw = cstr(pro_obj.doc.wip_warehouse)
def add_to_stock_entry_detail(self, source_wh, target_wh, item_dict, fg_item = 0, bom_no = ''):
for d in item_dict:
se_child = addchild(self.doc, 'mtn_details', 'Stock Entry Detail', 0, self.doclist)
se_child.s_warehouse = sw
se_child.t_warehouse = tw
se_child.s_warehouse = source_wh
se_child.t_warehouse = target_wh
se_child.fg_item = fg_item
se_child.item_code = cstr(d)
se_child.description = item_dict[d][1]
@ -219,24 +211,52 @@ class DocType:
se_child.qty = flt(item_dict[d][0])
se_child.transfer_qty = flt(item_dict[d][0])
se_child.conversion_factor = 1.00
if fg_item: se_child.bom_no = pro_obj.doc.bom_no
if fg_item: se_child.bom_no = bom_no
def validate_bom_no(self):
if self.doc.bom_no:
if not self.doc.fg_completed_qty:
msgprint("Please enter FG Completed Qty", raise_exception=1)
if not self.doc.consider_sa_items_as_raw_materials:
msgprint("Please confirm whether you want to consider sub assembly item as raw materials", raise_exception=1)
# get items
#------------------
def get_items(self):
pro_obj = self.doc.production_order and get_obj('Production Order', self.doc.production_order) or ''
self.validate_for_production_order(pro_obj)
self.get_raw_materials(pro_obj)
if self.doc.purpose == 'Production Order':
pro_obj = self.doc.production_order and get_obj('Production Order', self.doc.production_order) or ''
self.validate_for_production_order(pro_obj)
bom_no = pro_obj.doc.bom_no
fg_qty = (self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) or flt(pro_obj.doc.qty)
consider_sa_items_as_rm = pro_obj.doc.consider_sa_items
elif self.doc.purpose == 'Other':
self.validate_bom_no()
bom_no = self.doc.bom_no
fg_qty = self.doc.fg_completed_qty
consider_sa_items_as_rm = self.doc.consider_sa_items_as_raw_materials
self.get_raw_materials(bom_no, fg_qty, consider_sa_items_as_rm)
self.doc.clear_table(self.doclist, 'mtn_details', 1)
self.add_to_stock_entry_detail(pro_obj, self.item_dict)
sw = (self.doc.process == 'Backflush') and cstr(pro_obj.doc.wip_warehouse) or ''
tw = (self.doc.process == 'Material Transfer') and cstr(pro_obj.doc.wip_warehouse) or ''
self.add_to_stock_entry_detail(sw, tw, self.item_dict)
fg_item_dict = {}
if self.doc.process == 'Backflush':
item_dict = {cstr(pro_obj.doc.production_item) : [self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom]}
self.add_to_stock_entry_detail(pro_obj, item_dict, fg_item = 1)
sw = ''
tw = cstr(pro_obj.doc.fg_warehouse)
fg_item_dict = {cstr(pro_obj.doc.production_item) : [self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom]}
elif self.doc.purpose == 'Other' and self.doc.bom_no:
sw, tw = '', ''
item = sql("select item, description, uom from `tabBill Of Materials` where name = %s", self.doc.bom_no, as_dict=1)
fg_item_dict = {item[0]['item'] : [self.doc.fg_completed_qty, item[0]['description'], item[0]['uom']]}
if fg_item_dict:
self.add_to_stock_entry_detail(sw, tw, fg_item_dict, fg_item = 1, bom_no = bom_no)
def validate_transfer_qty(self):
@ -289,7 +309,7 @@ class DocType:
def validate_for_production_order(self, pro_obj):
if self.doc.purpose == 'Production Order' or self.doc.process or self.doc.production_order or flt(self.doc.fg_completed_qty):
if self.doc.purpose == 'Production Order' or self.doc.process or self.doc.production_order:
if self.doc.purpose != 'Production Order':
msgprint("Purpose should be 'Production Order'.")
raise Exception
@ -394,7 +414,6 @@ class DocType:
if cstr(pro_obj.doc.production_item) != cstr(d.item_code):
msgprint("Item %s in Stock Entry Detail as Row No %s do not match with Item %s in Production Order %s" % (cstr(d.item_code), cstr(d.idx), cstr(pro_obj.doc.production_item), cstr(pro_obj.doc.name)))
raise Exception
fg_qty = flt(fg_qty) + flt(d.transfer_qty)
if cstr(d.t_warehouse) != cstr(pro_obj.doc.fg_warehouse):
msgprint("As Item %s is FG Item. Target Warehouse should be same as FG Warehouse %s in Production Order %s, at Row No %s. " % ( cstr(d.item_code), cstr(pro_obj.doc.fg_warehouse), cstr(pro_obj.doc.name), cstr(d.idx)))
raise Exception
@ -408,6 +427,9 @@ class DocType:
if cstr(d.s_warehouse) != cstr(pro_obj.doc.wip_warehouse):
msgprint("As Item %s is Raw Material. Source Warehouse should be same as WIP Warehouse %s in Production Order %s, at Row No %s. " % ( cstr(d.item_code), cstr(pro_obj.doc.wip_warehouse), cstr(pro_obj.doc.name), cstr(d.idx)))
raise Exception
if d.fg_item and (self.doc.purpose == 'Other' or self.doc.process == 'Backflush'):
fg_qty = flt(fg_qty) + flt(d.transfer_qty)
d.save()
if self.doc.fg_completed_qty and flt(self.doc.fg_completed_qty) != flt(fg_qty):
msgprint("The Total of FG Qty %s in Stock Entry Detail do not match with FG Completed Qty %s" % (flt(fg_qty), flt(self.doc.fg_completed_qty)))

File diff suppressed because it is too large Load Diff

View File

@ -59,8 +59,7 @@ class DocType:
self.validate_item(s[0], count)
self.validate_warehouse(s[1], count)
# encode as ascii
self.data.append([d.encode("ascii") for d in s])
self.data.append(s)
count += 1
if not self.validated:
@ -76,7 +75,8 @@ class DocType:
def validate_item(self, item, count):
""" Validate item exists and non-serialized"""
det = sql("select item_code, has_serial_no from `tabItem` where name = '%s'"% cstr(item), as_dict = 1)
det = sql("select item_code, has_serial_no from `tabItem` \
where name = %s", cstr(item), as_dict = 1)
if not det:
msgprint("Item: " + cstr(item) + " mentioned at Row No. " + cstr(count) + "does not exist in the system")
self.validated = 0
@ -89,7 +89,7 @@ class DocType:
def validate_warehouse(self, wh, count,):
"""Validate warehouse exists"""
if not sql("select name from `tabWarehouse` where name = '%s'" % cstr(wh)):
if not sql("select name from `tabWarehouse` where name = %s", cstr(wh)):
msgprint("Warehouse: " + cstr(wh) + " mentioned at Row No. " + cstr(count) + " does not exist in the system")
self.validated = 0

View File

@ -39,7 +39,8 @@ class DocType:
self.doclist = doclist
def get_bin(self, item_code):
bin = sql("select name from tabBin where item_code = '%s' and warehouse = '%s'" % (item_code, self.doc.name))
bin = sql("select name from tabBin where item_code = %s and \
warehouse = %s", (item_code, self.doc.name))
bin = bin and bin[0][0] or ''
if not bin:
if not self.doc.warehouse_type :

View File

@ -49,7 +49,7 @@
<div class="section-item">
<a class="section-link"
title = "Readings of incoming quality inspections"
href="#!List/List/QA Inspection Report">Incoming Inspection</a>
href="#!List/QA Inspection Report">Incoming Inspection</a>
</div>
<div class="section-item">
<a class="section-link"
@ -71,7 +71,6 @@
title = "Helper for managing return of goods (sales or purchase)"
href="#!Form/Sales and Purchase Return Wizard/Sales and Purchase Return Wizard">Sales or Purchase Returns</a>
</div>
</div>
</div>
<div class="section">

View File

@ -20,7 +20,7 @@
.todoitem .ref_link {
float: left;
margin-left: 14px;
margin-left: 10px;
display: inline-block;
line-height: 18px;
}
@ -28,4 +28,4 @@
.todoitem .description {
cursor: pointer;
float: left;
}
}

View File

@ -45,10 +45,15 @@ erpnext.todo.ToDoItem = Class.extend({
'Low':''
}
todo.labelclass = label_map[todo.priority];
todo.userdate = dateutil.str_to_user(todo.date);
todo.userdate = dateutil.str_to_user(todo.date) || '';
if(todo.assigned_by) {
todo.fullname = repl("[By %(fullname)s] ", {
fullname: wn.boot.user_info[todo.assigned_by].fullname
})
} else { todo.fullname = ''; }
if(todo.reference_name && todo.reference_type) {
todo.link = repl('<a href="#!Form/%(reference_type)s/%(reference_name)s">\
%(reference_name)s</a>', todo);
%(reference_type)s: %(reference_name)s</a>', todo);
} else if(todo.reference_type) {
todo.link = repl('<a href="#!List/%(reference_type)s">\
%(reference_type)s</a>', todo);
@ -59,8 +64,8 @@ erpnext.todo.ToDoItem = Class.extend({
<span class="description">\
<span class="label %(labelclass)s">%(priority)s</span>\
<span class="help" style="margin-right: 7px">%(userdate)s</span>\
%(description)s</span>\
<span class="ref_link">&rarr;\
%(fullname)s%(description)s</span>\
<span class="ref_link">&rarr; &nbsp;\
%(link)s</span>\
<a href="#" class="close">&times;</a>\
</div>', todo));

View File

@ -81,12 +81,12 @@ class TransactionBase:
cond = 'name="%s"' % address_name
if is_shipping_address:
details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc limit 1" % cond, as_dict = 1)
details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc limit 1" % cond, as_dict = 1)
else:
details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1)
details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1)
extract = lambda x: details and details[0] and details[0].get(x,'') or ''
address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone')]
address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone'),('\nFax: ', 'fax')]
address_display = ''.join([a[0]+extract(a[1]) for a in address_fields if extract(a[1])])
if address_display.startswith('\n'): address_display = address_display[1:]
@ -145,7 +145,7 @@ class TransactionBase:
# Get Lead Details
# -----------------------
def get_lead_details(self, name):
details = webnotes.conn.sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1)
details = webnotes.conn.sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id, company_name from `tabLead` where name = '%s'" %(name), as_dict = 1)
extract = lambda x: details and details[0] and details[0].get(x,'') or ''
address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','contact_no')]
@ -157,7 +157,8 @@ class TransactionBase:
'address_display' : address_display,
'territory' : extract('territory'),
'contact_mobile' : extract('mobile_no'),
'contact_email' : extract('email_id')
'contact_email' : extract('email_id'),
'organization' : extract('company_name')
}
return ret

File diff suppressed because one or more lines are too long

View File

@ -595,7 +595,7 @@ var v=_f.get_value(this.doctype,this.docname,this.df.fieldname);else{if(this.opt
var v=this.options_list[0];else
var v=null;}
this.input.set_input(v);}
this.input.set_input=function(v){if(!v){if(!me.input.multiple){if(me.docname){if(me.options_list&&me.options_list.length){me.set(me.options_list[0]);me.input.value=me.options_list[0];}else{me.input.value='';}}}}else{if(me.options_list){if(me.input.multiple){for(var i=0;i<me.input.options.length;i++){me.input.options[i].selected=0;if(me.input.options[i].value&&inList(v.split(","),me.input.options[i].value))
this.input.set_input=function(v){if(!v){if(!me.input.multiple){if(me.docname){if(me.options_list&&me.options_list.length){me.set(me.options_list[0]);me.input.value=me.options_list[0];}else{me.input.value='';}}}}else{if(me.options_list){if(me.input.multiple){for(var i=0;i<me.input.options.length;i++){me.input.options[i].selected=0;if(me.input.options[i].value&&inList(typeof(v)=='string'?v.split(","):v,me.input.options[i].value))
me.input.options[i].selected=1;}}else if(in_list(me.options_list,v)){me.input.value=v;}}}}
this.get_value=function(){if(me.input.multiple){var l=[];for(var i=0;i<me.input.options.length;i++){if(me.input.options[i].selected)l[l.length]=me.input.options[i].value;}
return l;}else{if(me.input.options){var val=sel_val(me.input);if(!val&&!me.input.selectedIndex)
@ -1077,8 +1077,8 @@ else if(nm=='Accounts Browser')
pscript.make_chart(chart_type);}
loadpage(nm,call_back);}
var update_messages=function(reset){if(inList(['Guest'],user)){return;}
if(!reset){$c_page('home','event_updates','get_unread_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message);var circle=$('#msg_count')
if(circle){if(r.message.length){circle.find('span:first').text(r.message.length);circle.toggle(true);}else{circle.toggle(false);}}}else{clearInterval(wn.updates.id);}});}else{page_body.wntoolbar.set_new_comments(0);$('#msg_count').toggle(false);}}
if(!reset){$c_page('home','event_updates','get_global_status_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}}
show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);}else{clearInterval(wn.updates.id);}});}else{page_body.wntoolbar.set_new_comments(0);$('#unread_messages').toggle(false);}}
erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);}
wn.updates.id=setInterval(update_messages,60000);}
erpnext.set_user_background=function(src){set_style(repl('body { background: url("files/%(src)s") repeat;}',{src:src}))}

View File

@ -1 +1 @@
821
842

10
wnf.py
View File

@ -119,6 +119,9 @@ def setup_options():
parser.add_option("--replace", nargs=3, default=False,
metavar = "search replace_by extension",
help="file search-replace")
parser.add_option("--cci", nargs=1, metavar="CacheItem Key",
help="Clear Cache Item")
return parser.parse_args()
@ -231,6 +234,13 @@ def run():
import webnotes.utils.scheduler
print webnotes.utils.scheduler.trigger('execute_' + options.run_scheduler_event)
elif options.cci is not None:
if options.cci=='all':
webnotes.conn.sql("DELETE FROM __CacheItem")
else:
from webnotes.utils.cache import CacheItem
CacheItem(options.cci).clear()
# print messages
if webnotes.message_log:
print '\n'.join(webnotes.message_log)