diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index c4ed73c65e..af9de92bcd 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -421,8 +421,8 @@ class DocType(TransactionBase): raise Exception def validate_pos(self): - if not self.doc.cash_bank_account: - msgprint("Cash/Bank Account is mandatory for POS entry") + if not self.doc.cash_bank_account and flt(self.doc.paid_amount): + msgprint("Cash/Bank Account is mandatory for POS, for making payment entry") raise Exception if (flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) - round(flt(self.doc.grand_total), 2))>0.001: msgprint("(Paid amount + Write Off Amount) can not be greater than Grand Total") @@ -676,8 +676,14 @@ class DocType(TransactionBase): if not d.warehouse: d.warehouse = cstr(w) - if flt(self.doc.paid_amount) == 0: - webnotes.conn.set(self.doc,'paid_amount',(flt(self.doc.grand_total) - flt(self.doc.write_off_amount))) + if flt(self.doc.paid_amount) == 0: + if self.doc.cash_bank_account: + webnotes.conn.set(self.doc, 'paid_amount', + (flt(self.doc.grand_total) - flt(self.doc.write_off_amount))) + else: + # show message that the amount is not paid + webnotes.conn.set(self.doc,'paid_amount',0) + webnotes.msgprint("Note: Payment Entry not created since 'Cash/Bank Account' was not specified.") else: webnotes.conn.set(self.doc,'paid_amount',0) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py index 5157f7c2f8..e230e0f77b 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.py +++ b/erpnext/buying/doctype/purchase_common/purchase_common.py @@ -407,9 +407,21 @@ class DocType(TransactionBase): if not default_currency: msgprint('Message: Please enter default currency in Company Master') raise Exception - if (obj.doc.currency == default_currency and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != default_currency and flt(obj.doc.conversion_rate) == 1.00): - msgprint("Message: Please Enter Appropriate Conversion Rate.") - raise Exception + + if obj.doc.conversion_rate == 0: + msgprint('Conversion Rate cannot be 0', raise_exception=1) + elif not obj.doc.conversion_rate: + msgprint('Please specify Conversion Rate', raise_exception=1) + elif obj.doc.currency == default_currency and \ + flt(obj.doc.conversion_rate) != 1.00: + msgprint("""Conversion Rate should be equal to 1.00, \ + since the specified Currency and the company's currency \ + are same""", raise_exception=1) + elif obj.doc.currency != default_currency and \ + flt(obj.doc.conversion_rate) == 1.00: + msgprint("""Conversion Rate should not be equal to 1.00, \ + since the specified Currency and the company's currency \ + are different""", raise_exception=1) def validate_doc(self, obj, prevdoc_doctype, prevdoc_docname): if prevdoc_docname : diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js index 498dbb42e8..5678e98309 100644 --- a/erpnext/buying/doctype/supplier/supplier.js +++ b/erpnext/buying/doctype/supplier/supplier.js @@ -105,47 +105,48 @@ cur_frm.cscript.make_contact = function() { cur_frm.contact_list.run(); } -// make purchase order list -cur_frm.cscript.make_po_list = function(parent, doc){ - wn.require('js/listing.js'); - var lst = new Listing(); - lst.colwidths = ['5%','25%','20%','25%','25%']; - lst.colnames = ['Sr.','Id','Status','PO Date','Grand Total']; - lst.coltypes = ['Data','Link','Data','Data','Currency']; - lst.coloptions = ['','Purchase Order','','','','']; - var q = repl("select name,status,transaction_date, grand_total from `tabPurchase Order` where supplier='%(sup)s' order by transaction_date desc", {'sup':doc.name}); - var q_max = repl("select count(name) from `tabPurchase Order` where supplier='%(sup)s'", {'sup':doc.name}); - - cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Order','Purchase Order'); +// Transaction History + +cur_frm.cscript.make_po_list = function(parent, doc) { + cur_frm.cscript.render_transaction_history(parent, doc, 'Purchase Order', + [ + {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'}, + {fieldname: 'status', width: '25%', label: 'Status', type: 'Data'}, + {fieldname: 'modified', width: '12%', label: 'Last Modified On', + type: 'Date', style: 'text-align: right; color: #777'}, + {fieldname: 'currency', width: '0%', label: 'Currency', + style: 'display: hidden'}, + {fieldname: 'grand_total', width: '35%', label: 'Grand Total', + type: 'Currency', style: 'text-align: right'}, + ]); } -// make purchase receipt list -cur_frm.cscript.make_pr_list = function(parent,doc){ - wn.require('js/listing.js'); - var lst = new Listing(); - lst.colwidths = ['5%','20%','20%','20%','15%','20%']; - lst.colnames = ['Sr.','Id','Status','Receipt Date','% Billed','Grand Total']; - lst.coltypes = ['Data','Link','Data','Data','Currency','Currency']; - lst.coloptions = ['','Purchase Receipt','','','','']; - - var q = repl("select name,status,transaction_date,per_billed,grand_total from `tabPurchase Receipt` where supplier='%(sup)s' order by transaction_date desc", {'sup':doc.name}); - var q_max = repl("select count(name) from `tabPurchase Receipt` where supplier='%(sup)s'", {'sup':doc.name}); - - cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Receipt','Purchase Receipt'); +cur_frm.cscript.make_pr_list = function(parent, doc) { + cur_frm.cscript.render_transaction_history(parent, doc, 'Purchase Receipt', + [ + {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'}, + {fieldname: 'status', width: '15%', label: 'Status', type: 'Data'}, + {fieldname: 'per_billed', width: '10%', label: '% Billed', + type: 'Percentage', style: 'text-align: right'}, + {fieldname: 'modified', width: '12%', label: 'Last Modified On', + type: 'Date', style: 'text-align: right; color: #777'}, + {fieldname: 'currency', width: '0%', label: 'Currency', + style: 'display: hidden'}, + {fieldname: 'grand_total', width: '35%', label: 'Grand Total', + type: 'Currency', style: 'text-align: right'}, + ]); } -// make purchase invoice list -cur_frm.cscript.make_pi_list = function(parent,doc){ - wn.require('js/listing.js'); - var lst = new Listing(); - lst.colwidths = ['5%','20%','20%','20%','15%','20%']; - lst.colnames = ['Sr.','Id','Posting Date','Credit To','Bill Date','Grand Total']; - lst.coltypes = ['Data','Link','Data','Data','Currency','Currency']; - lst.coloptions = ['','Purchase Invoice','','','','']; - - var q = repl("select name, posting_date, credit_to, bill_date, grand_total from `tabPurchase Invoice` where supplier='%(sup)s' order by posting_date desc", {'sup':doc.name}); - var q_max = repl("select count(name) from `tabPurchase Invoice` where supplier='%(sup)s'", {'sup':doc.name}); - - cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Invoice','Purchase Invoice'); -} +cur_frm.cscript.make_pi_list = function(parent, doc) { + cur_frm.cscript.render_transaction_history(parent, doc, 'Purchase Invoice', + [ + {fieldname: 'name', width: '30%', label: 'Id', type: 'Link'}, + {fieldname: 'modified', width: '35%', label: 'Last Modified On', + type: 'Date', style: 'text-align: right; color: #777'}, + {fieldname: 'currency', width: '0%', label: 'Currency', + style: 'display: hidden'}, + {fieldname: 'grand_total', width: '35%', label: 'Grand Total', + type: 'Currency', style: 'text-align: right'}, + ]); +} \ No newline at end of file diff --git a/erpnext/patches/may_2012/remove_euro_currency.py b/erpnext/patches/may_2012/remove_euro_currency.py new file mode 100644 index 0000000000..2fb53738af --- /dev/null +++ b/erpnext/patches/may_2012/remove_euro_currency.py @@ -0,0 +1,17 @@ +def execute(): + """ + * Replace EURO with EUR + * Delete EURO from tabCurrency + """ + import webnotes + tables = webnotes.conn.sql("show tables") + for (tab,) in tables: + desc = webnotes.conn.sql("desc `%s`" % tab, as_dict=1) + for d in desc: + if "currency" in d.get('Field'): + field = d.get('Field') + webnotes.conn.sql("""\ + update `%s` set `%s`='EUR' + where `%s`='EURO'""" % (tab, field, field)) + webnotes.conn.sql("update `tabSingles` set value='EUR' where value='EURO'") + webnotes.conn.sql("delete from `tabCurrency` where name='EURO'") \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index e781e9d4ce..32a1e77d72 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -402,4 +402,9 @@ patch_list = [ 'patch_file': 'profile_perm_patch', 'description': 'Make profile readonly for role All' }, + { + 'patch_module': 'patches.may_2012', + 'patch_file': 'remove_euro_currency', + 'description': 'Remove EURO currency and replace with EUR' + }, ] \ No newline at end of file diff --git a/erpnext/production/doctype/production_order/production_order.txt b/erpnext/production/doctype/production_order/production_order.txt index 62aa610217..c244399278 100644 --- a/erpnext/production/doctype/production_order/production_order.txt +++ b/erpnext/production/doctype/production_order/production_order.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:05', + 'creation': '2012-05-15 12:14:48', 'docstatus': 0, - 'modified': '2012-03-27 14:45:50', + 'modified': '2012-05-28 19:03:56', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -23,7 +23,7 @@ 'section_style': u'Tabbed', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 190 + 'version': 1 }, # These values are common for all DocField @@ -323,6 +323,7 @@ 'fieldname': u'produced_qty', 'fieldtype': u'Currency', 'label': u'Produced Qty', + 'no_copy': 1, 'oldfieldname': u'produced_qty', 'oldfieldtype': u'Currency', 'permlevel': 1 diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 3ff20a3e84..f64d3f2946 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -148,114 +148,63 @@ cur_frm.fields_dict['lead_name'].get_query = function(doc,dt,dn){ return 'SELECT `tabLead`.`name` FROM `tabLead` WHERE `tabLead`.`status`!="Converted" AND `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50'; } -/* ********************************* transaction history ************************************** */ -cur_frm.render_transaction_history_row = function(data) { - data.grand_total = fmt_money(data.grand_total); - data.modified = wn.datetime.only_date(data.modified); - return repl('\ - \ - \ - \ - \ - \ -
\ - %(name)s \ - %(status)s \ - %(currency)s %(grand_total)s \ - \ - %(modified)s \ -
', data); +// Transaction History +// functions called by these functions are defined in contact_control.js +cur_frm.cscript.make_qtn_list = function(parent, doc) { + cur_frm.cscript.render_transaction_history(parent, doc, 'Quotation', + [ + {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'}, + {fieldname: 'status', width: '25%', label: 'Status', type: 'Data'}, + {fieldname: 'modified', width: '12%', label: 'Last Modified On', + type: 'Date', style: 'text-align: right; color: #777'}, + {fieldname: 'currency', width: '0%', label: 'Currency', + style: 'display: hidden'}, + {fieldname: 'grand_total', width: '35%', label: 'Grand Total', + type: 'Currency', style: 'text-align: right'}, + ]); } -cur_frm.get_query_transaction_history = function(args) { - return repl("\ - select name, status, modified, currency, \ - grand_total \ - from `tab%(doctype)s` \ - where customer='%(customer)s' \ - order by modified desc", args); +cur_frm.cscript.make_so_list = function(parent, doc) { + cur_frm.cscript.render_transaction_history(parent, doc, 'Sales Order', + [ + {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'}, + {fieldname: 'status', width: '25%', label: 'Status', type: 'Data'}, + {fieldname: 'modified', width: '12%', label: 'Last Modified On', + type: 'Date', style: 'text-align: right; color: #777'}, + {fieldname: 'currency', width: '0%', label: 'Currency', + style: 'display: hidden'}, + {fieldname: 'grand_total', width: '35%', label: 'Grand Total', + type: 'Currency', style: 'text-align: right'}, + ]); } -cur_frm.render_transaction_history = function(parent, doc, doctype, get_query, render_row) { - $(parent).css({ - 'padding-top': '10px', - }); - - cur_frm.transaction_list = new wn.ui.Listing({ - parent: parent, - page_length: 10, - get_query: get_query || function() { - return cur_frm.get_query_transaction_history({ - customer: doc.name, - doctype: doctype, - }); - }, - as_dict: 1, - no_result_message: repl('No %(doctype)s created for this customer', { doctype: doctype }), - render_row: function(wrapper, data) { - data.doctype = doctype; - render_html = render_row - ? render_row(data) - : cur_frm.render_transaction_history_row(data); - $(wrapper).html(render_html); - }, - }); - - cur_frm.transaction_list.run(); -} -// -------------------- -// make quotation list -// -------------------- -cur_frm.cscript.make_qtn_list = function(parent,doc){ - cur_frm.render_transaction_history(parent, doc, 'Quotation'); +cur_frm.cscript.make_dn_list = function(parent, doc) { + cur_frm.cscript.render_transaction_history(parent, doc, 'Delivery Note', + [ + {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'}, + {fieldname: 'status', width: '25%', label: 'Status', type: 'Data'}, + {fieldname: 'modified', width: '12%', label: 'Last Modified On', + type: 'Date', style: 'text-align: right; color: #777'}, + {fieldname: 'currency', width: '0%', label: 'Currency', + style: 'display: hidden'}, + {fieldname: 'grand_total', width: '35%', label: 'Grand Total', + type: 'Currency', style: 'text-align: right'}, + ]); } -// ------------- -// make so list -// ------------- -cur_frm.cscript.make_so_list = function(parent,doc){ - cur_frm.render_transaction_history(parent, doc, 'Sales Order'); -} - - -// ------------- -// make dn list -// ------------- -cur_frm.cscript.make_dn_list = function(parent,doc){ - cur_frm.render_transaction_history(parent, doc, 'Delivery Note'); -} - -// ------------- -// make si list -// ------------- -cur_frm.cscript.make_si_list = function(parent,doc){ - cur_frm.render_transaction_history(parent, doc, 'Sales Invoice', function() { - return repl("\ - select name, outstanding_amount, modified, currency, \ - grand_total \ - from `tab%(doctype)s` \ - where customer='%(customer)s' \ - order by modified desc", { doctype: 'Sales Invoice', customer: doc.name }); - }, function(data) { - data.grand_total = fmt_money(data.grand_total); - data.modified = wn.datetime.only_date(data.modified); - data.outstanding_amount = fmt_money(data.outstanding_amount); - return repl('\ - \ - \ - \ - \ - \ -
\ - %(name)s \ - \ - %(currency)s %(outstanding_amount)s \ - \ - %(currency)s %(grand_total)s\ - \ - %(modified)s \ -
', data); - }); +cur_frm.cscript.make_si_list = function(parent, doc) { + cur_frm.cscript.render_transaction_history(parent, doc, 'Sales Invoice', + [ + {fieldname: 'name', width: '28%', label: 'Id', type: 'Link'}, + {fieldname: 'outstanding_amount', width: '25%', + label: 'Outstanding Amount', + type: 'Currency', style: 'text-align: right; color: #777'}, + {fieldname: 'modified', width: '12%', label: 'Last Modified On', + type: 'Date', style: 'text-align: right; color: #777'}, + {fieldname: 'currency', width: '0%', label: 'Currency', + style: 'display: hidden'}, + {fieldname: 'grand_total', width: '35%', label: 'Grand Total', + type: 'Currency', style: 'text-align: right'}, + ]); } \ No newline at end of file diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py index a04b058505..21f83b536f 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.py +++ b/erpnext/selling/doctype/sales_common/sales_common.py @@ -207,21 +207,32 @@ 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, t1.cost_center_other_charges from `tabSales Taxes and Charges` t1, `tabSales Taxes and Charges Master` 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.* + from + `tabSales Taxes and Charges` t1, + `tabSales Taxes and Charges Master` t2 + where + t1.parent = t2.name and + t2.company = '%s' and + %s + order by t1.idx""" % (obj.doc.company, add_cond), as_dict=1) + from webnotes.model import default_fields for other in other_charge: - d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 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']) + # remove default fields like parent, parenttype etc. + # from query results + for field in default_fields: + if field in other: del other[field] + + d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1, + obj.doclist) + d.fields.update(other) + d.rate = flt(d.rate) + d.tax_amount = flt(d.tax_rate) + d.included_in_print_rate = cint(d.included_in_print_rate) d.idx = idx idx += 1 - # Get TERMS AND CONDITIONS # ======================================================================================= def get_tc_details(self,obj): @@ -352,8 +363,10 @@ class DocType(TransactionBase): if self.has_sales_bom(d.item_code): for p in getlist(obj.doclist, 'packing_details'): - if p.parent_item == d.item_code: - il.append([warehouse, p.item_code, flt(p.qty)*qty, flt(p.qty)* reserved_qty, p.uom, p.batch_no, p.serial_no]) + #if p.parent_item == d.item_code: -- this fails when item with same name appears more than once in delivery note item table + if p.parent_detail_docname == d.name: + # the packing details table's qty is already multiplied with parent's qty + il.append([warehouse, p.item_code, flt(p.qty), (flt(p.qty)/qty)*(reserved_qty), p.uom, p.batch_no, p.serial_no]) else: il.append([warehouse, d.item_code, qty, reserved_qty, d.stock_uom, d.batch_no, d.serial_no]) return il @@ -424,6 +437,10 @@ class DocType(TransactionBase): pi.serial_no = cstr(line.serial_no) pi.batch_no = cstr(line.batch_no) pi.idx = self.packing_list_idx + + # has to be saved, since this function is called on_update of delivery note + pi.save() + self.packing_list_idx += 1 diff --git a/erpnext/setup/doctype/contact_control/contact_control.js b/erpnext/setup/doctype/contact_control/contact_control.js index 51fc5cf4ae..f9dc2c9b95 100755 --- a/erpnext/setup/doctype/contact_control/contact_control.js +++ b/erpnext/setup/doctype/contact_control/contact_control.js @@ -121,3 +121,80 @@ if(cur_frm.fields_dict['territory']){ return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } } + + +// Transaction History related functions +cur_frm.cscript.render_transaction_history = function(parent, doc, doctype, args) { + $(parent).css({ 'padding-top': '10px' }); + cur_frm.transaction_list = new wn.ui.Listing({ + parent: parent, + page_length: 10, + get_query: function() { + return cur_frm.cscript.get_query_transaction_history({ + parent: doc.doctype.toLowerCase(), + parent_name: doc.name, + doctype: doctype, + fields: (function() { + var fields = []; + for(var i in args) { + fields.push(args[i].fieldname); + } + return fields.join(", "); + })(), + }); + }, + as_dict: 1, + no_result_message: repl('No %(doctype)s created for this %(parent)s', + { doctype: doctype, parent: doc.doctype }), + render_row: function(wrapper, data) { + render_html = cur_frm.cscript.render_transaction_history_row(data, args, doctype); + $(wrapper).html(render_html); + }, + }); + cur_frm.transaction_list.run(); +} + +cur_frm.cscript.render_transaction_history_row = function(data, args, doctype) { + var content = []; + var currency = data.currency; + for (var a in args) { + for (var d in data) { + if (args[a].fieldname === d && args[a].fieldname !== 'currency') { + if (args[a].type === 'Link') { + data[d] = repl('\ + %(name)s', { doctype: doctype, name: data[d]}); + } else if (args[a].type === 'Currency') { + data[d] = currency + " " + fmt_money(data[d]); + } else if (args[a].type === 'Percentage') { + data[d] = flt(data[d]) + '%'; + } else if (args[a].type === 'Date') { + data[d] = wn.datetime.only_date(data[d]); + } + if (args[a].style == undefined) { + args[a].style = ''; + } + data[d] = repl('\ + \ + %(content)s', + { + content: data[d], + width: args[a].width, + title: args[a].label, + style: args[a].style, + }); + content.push(data[d]); + break; + } + } + } + content = content.join("\n"); + return '' + content + '
'; +} + +cur_frm.cscript.get_query_transaction_history = function(args) { + var query = repl("\ + select %(fields)s from `tab%(doctype)s` \ + where %(parent)s = '%(parent_name)s' \ + order by modified desc", args); + return query; +} \ No newline at end of file diff --git a/erpnext/startup/js/modules.js b/erpnext/startup/js/modules.js index 2e0e701197..2799fa1300 100644 --- a/erpnext/startup/js/modules.js +++ b/erpnext/startup/js/modules.js @@ -61,22 +61,40 @@ erpnext.module_page.hide_links = function(wrapper) { erpnext.module_page.make_list = function(module, wrapper) { // make project listing - wrapper.list = new wn.ui.Listing({ - parent: $(wrapper).find('.reports-list').get(0), - method: 'utilities.get_report_list', + var $w = $(wrapper).find('.reports-list'); + var $parent1 = $('
').appendTo($w); + var $parent2 = $('
').appendTo($w); + + wrapper.list1 = new wn.ui.Listing({ + parent: $parent1, + method: 'utilities.get_sc_list', render_row: function(row, data) { if(!data.parent_doc_type) data.parent_doc_type = data.doc_type; $(row).html(repl('\ %(criteria_name)s', data)) }, - args: { - module: module - }, + args: { module: module }, no_refresh: true, callback: function(r) { - erpnext.module_page.hide_links(wrapper) + erpnext.module_page.hide_links($parent1) } }); - wrapper.list.run(); + wrapper.list1.run(); + + wrapper.list2 = new wn.ui.Listing({ + parent: $parent2, + method: 'utilities.get_report_list', + render_row: function(row, data) { + $(row).html(repl('\ + %(name)s', data)) + }, + args: { module: module }, + no_refresh: true, + callback: function(r) { + erpnext.module_page.hide_links($parent2) + } + }); + wrapper.list2.run(); } \ No newline at end of file diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index fa4144b839..61ebe3f4b7 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -182,7 +182,6 @@ class DocType(TransactionBase): #self.validate_prevdoc_details() self.validate_reference_value() self.validate_for_items() - sales_com_obj.make_packing_list(self,'delivery_note_details') sales_com_obj.validate_max_discount(self, 'delivery_note_details') #verify whether rate is not greater than max discount sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100% sales_com_obj.check_conversion_rate(self) @@ -474,6 +473,7 @@ class DocType(TransactionBase): # on update def on_update(self): + get_obj('Sales Common').make_packing_list(self,'delivery_note_details') self.set_actual_qty() get_obj('Stock Ledger').scrub_serial_nos(self) diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py index d57f0def05..f6f38596ff 100644 --- a/erpnext/utilities/__init__.py +++ b/erpnext/utilities/__init__.py @@ -17,7 +17,7 @@ import webnotes @webnotes.whitelist() -def get_report_list(arg=None): +def get_sc_list(arg=None): """return list of reports for the given module module""" webnotes.response['values'] = webnotes.conn.sql("""select distinct criteria_name, doc_type, parent_doc_type @@ -26,4 +26,16 @@ def get_report_list(arg=None): and docstatus in (0, NULL) and ifnull(disabled, 0) = 0 order by criteria_name + limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True) + +@webnotes.whitelist() +def get_report_list(): + """return list on new style reports for modules""" + webnotes.response['values'] = webnotes.conn.sql("""select + distinct tabReport.name, tabReport.ref_doctype + from `tabReport`, `tabDocType` + where tabDocType.module='%(module)s' + and tabDocType.name = tabReport.ref_doctype + and tabReport.docstatus in (0, NULL) + order by tabReport.name limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True) \ No newline at end of file diff --git a/erpnext/utilities/doctype/address/address.js b/erpnext/utilities/doctype/address/address.js index 8949c5a9eb..c4631f8063 100644 --- a/erpnext/utilities/doctype/address/address.js +++ b/erpnext/utilities/doctype/address/address.js @@ -20,17 +20,17 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { var route = wn.get_route(); if(route[1]=='Supplier') { - var supplier = locals.Supplier[route[2]] + var supplier = wn.container.page.frm.doc; doc.supplier = supplier.name; doc.supplier_name = supplier.supplier_name; doc.address_type = 'Office'; } else if(route[1]=='Customer') { - var customer = locals.Customer[route[2]] + var customer = wn.container.page.frm.doc; doc.customer = customer.name; doc.customer_name = customer.customer_name; doc.address_type = 'Office'; } else if(route[1]=='Sales Partner') { - var sp = locals['Sales Partner'][route[2]]; + var sp = wn.container.page.frm.doc; doc.sales_partner = sp.name; doc.address_type = 'Office'; } diff --git a/erpnext/utilities/doctype/contact/contact.js b/erpnext/utilities/doctype/contact/contact.js index ae06ed4203..1b0894ee21 100644 --- a/erpnext/utilities/doctype/contact/contact.js +++ b/erpnext/utilities/doctype/contact/contact.js @@ -21,18 +21,18 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { var route = wn.get_route(); if(route[1]=='Supplier') { - var supplier = locals.Supplier[route[2]] + var supplier = wn.container.page.frm.doc; doc.supplier = supplier.name; doc.supplier_name = supplier.supplier_name; } else if(route[1]=='Customer') { - var customer = locals.Customer[route[2]]; + var customer = wn.container.page.frm.doc; doc.customer = customer.name; doc.customer_name = customer.customer_name; if(customer.customer_type == 'Individual') { doc.first_name = customer.customer_name; } } else if(route[1]=='Sales Partner') { - var sp = locals['Sales Partner'][route[2]]; + var sp = wn.container.page.frm.doc; doc.sales_partner = sp.name; } } diff --git a/public/css/all-app.css b/public/css/all-app.css index a5378a69fc..4f5d548503 100644 --- a/public/css/all-app.css +++ b/public/css/all-app.css @@ -3276,51 +3276,71 @@ div.appframe-toolbar { font-family: 'Pontano Sans'; font-style: normal; font-weight: 800; - src: url('../lib/css/fonts/pontanosans.woff') format('woff'); + src: url('fonts/pontanosans.woff') format('woff'); } @font-face { font-family: 'Droid Sans'; font-style: normal; font-weight: normal; - src: local('Droid Sans'), local('DroidSans'), url('../lib/css/fonts/droidsans.woff') format('woff'); + src: local('Droid Sans'), local('DroidSans'), url('fonts/droidsans.woff') format('woff'); } @font-face { font-family: 'PT Sans'; font-style: normal; font-weight: normal; - src: local('PT Sans'), local('PTSans-Regular'), url('../lib/css/fonts/ptsans.woff') format('woff'); + src: local('PT Sans'), local('PTSans-Regular'), url('fonts/ptsans.woff') format('woff'); } @font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 400; - src: local('Open Sans'), local('OpenSans'), url('../lib/css/fonts/opensans.woff') format('woff'); + src: local('Open Sans'), local('OpenSans'), url('fonts/opensans.woff') format('woff'); } @font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; - src: local('Lato Regular'), local('Lato-Regular'), url('../lib/css/fonts/lato.woff') format('woff'); + src: local('Lato Regular'), local('Lato-Regular'), url('fonts/lato.woff') format('woff'); } @font-face { font-family: 'Cabin'; font-style: normal; font-weight: 400; - src: local('Cabin Regular'), local('Cabin-Regular'), url('../lib/css/fonts/cabin.woff') format('woff'); + src: local('Cabin Regular'), local('Cabin-Regular'), url('fonts/cabin.woff') format('woff'); } @font-face { font-family: 'Pacifico'; font-style: normal; font-weight: normal; - src: local('Pacifico Regular'), local('Pacifico-Regular'), url('../lib/css/fonts/pacifico.woff') format('woff'); + src: local('Pacifico Regular'), local('Pacifico-Regular'), url('fonts/pacifico.woff') format('woff'); } +@font-face { + font-family: 'Oleo Script'; + font-style: normal; + font-weight: 400; + src: local('Oleo Script'), local('OleoScript-Regular'), url('fonts/oleoscript.woff') format('woff'); +} + +@font-face { + font-family: 'Cookie'; + font-style: normal; + font-weight: 400; + src: local('Cookie-Regular'), url('fonts/cookie.woff') format('woff'); +} + +@font-face { + font-family: 'Marck Script'; + font-style: normal; + font-weight: 400; + src: local('Marck Script'), local('MarckScript-Regular'), url('fonts/marckscript.woff') format('woff'); +} /* diff --git a/public/css/all-web.css b/public/css/all-web.css index e5188201cf..1848143695 100644 --- a/public/css/all-web.css +++ b/public/css/all-web.css @@ -2271,51 +2271,71 @@ div.dialog_row table td textarea { font-family: 'Pontano Sans'; font-style: normal; font-weight: 800; - src: url('../lib/css/fonts/pontanosans.woff') format('woff'); + src: url('fonts/pontanosans.woff') format('woff'); } @font-face { font-family: 'Droid Sans'; font-style: normal; font-weight: normal; - src: local('Droid Sans'), local('DroidSans'), url('../lib/css/fonts/droidsans.woff') format('woff'); + src: local('Droid Sans'), local('DroidSans'), url('fonts/droidsans.woff') format('woff'); } @font-face { font-family: 'PT Sans'; font-style: normal; font-weight: normal; - src: local('PT Sans'), local('PTSans-Regular'), url('../lib/css/fonts/ptsans.woff') format('woff'); + src: local('PT Sans'), local('PTSans-Regular'), url('fonts/ptsans.woff') format('woff'); } @font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 400; - src: local('Open Sans'), local('OpenSans'), url('../lib/css/fonts/opensans.woff') format('woff'); + src: local('Open Sans'), local('OpenSans'), url('fonts/opensans.woff') format('woff'); } @font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; - src: local('Lato Regular'), local('Lato-Regular'), url('../lib/css/fonts/lato.woff') format('woff'); + src: local('Lato Regular'), local('Lato-Regular'), url('fonts/lato.woff') format('woff'); } @font-face { font-family: 'Cabin'; font-style: normal; font-weight: 400; - src: local('Cabin Regular'), local('Cabin-Regular'), url('../lib/css/fonts/cabin.woff') format('woff'); + src: local('Cabin Regular'), local('Cabin-Regular'), url('fonts/cabin.woff') format('woff'); } @font-face { font-family: 'Pacifico'; font-style: normal; font-weight: normal; - src: local('Pacifico Regular'), local('Pacifico-Regular'), url('../lib/css/fonts/pacifico.woff') format('woff'); + src: local('Pacifico Regular'), local('Pacifico-Regular'), url('fonts/pacifico.woff') format('woff'); } +@font-face { + font-family: 'Oleo Script'; + font-style: normal; + font-weight: 400; + src: local('Oleo Script'), local('OleoScript-Regular'), url('fonts/oleoscript.woff') format('woff'); +} + +@font-face { + font-family: 'Cookie'; + font-style: normal; + font-weight: 400; + src: local('Cookie-Regular'), url('fonts/cookie.woff') format('woff'); +} + +@font-face { + font-family: 'Marck Script'; + font-style: normal; + font-weight: 400; + src: local('Marck Script'), local('MarckScript-Regular'), url('fonts/marckscript.woff') format('woff'); +} /* diff --git a/public/css/fonts/cabin.woff b/public/css/fonts/cabin.woff new file mode 100644 index 0000000000..6f24a8af4e Binary files /dev/null and b/public/css/fonts/cabin.woff differ diff --git a/public/css/fonts/cookie.woff b/public/css/fonts/cookie.woff new file mode 100644 index 0000000000..454762dfc8 Binary files /dev/null and b/public/css/fonts/cookie.woff differ diff --git a/public/css/fonts/droidsans.woff b/public/css/fonts/droidsans.woff new file mode 100644 index 0000000000..3807cd67d7 Binary files /dev/null and b/public/css/fonts/droidsans.woff differ diff --git a/public/css/fonts/lato.woff b/public/css/fonts/lato.woff new file mode 100644 index 0000000000..ad1a467b71 Binary files /dev/null and b/public/css/fonts/lato.woff differ diff --git a/public/css/fonts/marckscript.woff b/public/css/fonts/marckscript.woff new file mode 100644 index 0000000000..e5f1f0bd8d Binary files /dev/null and b/public/css/fonts/marckscript.woff differ diff --git a/public/css/fonts/oleoscript.woff b/public/css/fonts/oleoscript.woff new file mode 100644 index 0000000000..feb3f96621 Binary files /dev/null and b/public/css/fonts/oleoscript.woff differ diff --git a/public/css/fonts/opensans.woff b/public/css/fonts/opensans.woff new file mode 100644 index 0000000000..58e6cb3818 Binary files /dev/null and b/public/css/fonts/opensans.woff differ diff --git a/public/css/fonts/pacifico.woff b/public/css/fonts/pacifico.woff new file mode 100644 index 0000000000..373c3815f6 Binary files /dev/null and b/public/css/fonts/pacifico.woff differ diff --git a/public/css/fonts/pontanosans.woff b/public/css/fonts/pontanosans.woff new file mode 100644 index 0000000000..d728f0ca15 Binary files /dev/null and b/public/css/fonts/pontanosans.woff differ diff --git a/public/css/fonts/ptsans.woff b/public/css/fonts/ptsans.woff new file mode 100644 index 0000000000..56c598d1a7 Binary files /dev/null and b/public/css/fonts/ptsans.woff differ diff --git a/public/js/all-app.js b/public/js/all-app.js index 3d2b40a53f..c5e760e3ca 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -959,7 +959,7 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype){this.doctype=d
Loading...
\ \
\ -
\ +
\

Show

\
Drafts
\
Submitted
\ @@ -978,7 +978,7 @@ this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.wid

',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;} me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this -wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('

Tags

\ +wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});if(me.listview.stats.length){$('').click(function(){me.reload_stats();}).appendTo($('
').appendTo(me.$page.find('.layout-side-section')))}}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('

Tags

\
No records tagged.

\ To add a tag, open the document and click on \ "Add Tag" on the sidebar
');} @@ -995,7 +995,7 @@ args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$i \ %(label)s \ (%(count)s)
\ -
',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}} +
',args));this.setup_stat_item_click($item);return $item;},reload_stats:function(){this.$page.find('.layout-side-section .stat-wrapper').remove();this.init_stats();},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}} this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];this.show_hide_check_column();},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#222'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});} if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;} if(typeof opts.content=='function'){opts.content(parent,data);} @@ -2284,9 +2284,11 @@ erpnext.hide_naming_series=function(){if(cur_frm.fields_dict.naming_series){hide */ wn.provide('erpnext.module_page');erpnext.module_page.setup_page=function(module,wrapper){erpnext.module_page.hide_links(wrapper);erpnext.module_page.make_list(module,wrapper);$(wrapper).find("a[title]").tooltip({delay:{show:500,hide:100}});} erpnext.module_page.hide_links=function(wrapper){$(wrapper).find('[href*="List/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[data-doctype]').each(function(){var dt=$(this).attr('data-doctype');if(wn.boot.profile.all_read.indexOf(dt)==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});$(wrapper).find('[href*="Form/"]').each(function(){var href=$(this).attr('href');var dt=href.split('/')[1];if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1){var txt=$(this).text();$(this).parent().css('color','#999').html(txt);}});} -erpnext.module_page.make_list=function(module,wrapper){wrapper.list=new wn.ui.Listing({parent:$(wrapper).find('.reports-list').get(0),method:'utilities.get_report_list',render_row:function(row,data){if(!data.parent_doc_type)data.parent_doc_type=data.doc_type;$(row).html(repl('
').appendTo($w);var $parent2=$('
').appendTo($w);wrapper.list1=new wn.ui.Listing({parent:$parent1,method:'utilities.get_sc_list',render_row:function(row,data){if(!data.parent_doc_type)data.parent_doc_type=data.doc_type;$(row).html(repl('
\ - %(criteria_name)s',data))},args:{module:module},no_refresh:true,callback:function(r){erpnext.module_page.hide_links(wrapper)}});wrapper.list.run();} + %(criteria_name)s',data))},args:{module:module},no_refresh:true,callback:function(r){erpnext.module_page.hide_links($parent1)}});wrapper.list1.run();wrapper.list2=new wn.ui.Listing({parent:$parent2,method:'utilities.get_report_list',render_row:function(row,data){$(row).html(repl('\ + %(name)s',data))},args:{module:module},no_refresh:true,callback:function(r){erpnext.module_page.hide_links($parent2)}});wrapper.list2.run();} /* * erpnext/startup/js/toolbar.js */ diff --git a/update_erpnext.py b/update_erpnext.py new file mode 100644 index 0000000000..341fafda12 --- /dev/null +++ b/update_erpnext.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +import commands + +cmd_list = [ + 'lib/wnf.py --pull origin master', + 'lib/wnf.py -l', + 'lib/wnf.py --sync_all' +] +err = 0 +for cmd in cmd_list: + stat, op = commands.getstatusoutput(cmd) + if stat != 0: + print "something went wrong" + print "cannot proceed with update" + print "status: %s" % stat + print "output: %s" % op + err = 1 + break + +if not err: + print "update_erpnext.py --> run success." +else: + print "update_erpnext.py --> run failed." \ No newline at end of file