From f870527e7cc3cc08b0db5dc55b9642967267aa9b Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 16 Dec 2014 17:19:36 +0530 Subject: [PATCH] [design] wip --- .../doctype/cost_center/cost_center.js | 2 +- .../journal_voucher/journal_voucher.js | 2 +- .../purchase_invoice/purchase_invoice.js | 2 +- .../doctype/sales_invoice/sales_invoice.js | 8 +-- .../hr/doctype/expense_claim/expense_claim.js | 5 +- .../leave_application/leave_application.js | 3 - .../public/js/controllers/stock_controller.js | 4 +- erpnext/selling/doctype/lead/lead.js | 2 +- .../selling/doctype/quotation/quotation.js | 2 +- .../setup/doctype/item_group/item_group.js | 2 +- .../doctype/delivery_note/delivery_note.js | 2 +- erpnext/templates/form_grid/item_grid.html | 61 ++++++++++--------- 12 files changed, 45 insertions(+), 50 deletions(-) diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js index d9e71d98ed..1ed0ab6136 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.js +++ b/erpnext/accounts/doctype/cost_center/cost_center.js @@ -51,7 +51,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger') cur_frm.set_intro(intro_txt); - cur_frm.appframe.add_button(__('Chart of Cost Centers'), + cur_frm.add_custom_button(__('Chart of Cost Centers'), function() { frappe.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap') } diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js index b1d4af0d10..21fbf1a0b8 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js @@ -139,7 +139,7 @@ cur_frm.cscript.refresh = function(doc) { erpnext.toggle_naming_series(); cur_frm.cscript.voucher_type(doc); if(doc.docstatus==1) { - cur_frm.appframe.add_button(__('View Ledger'), function() { + cur_frm.add_custom_button(__('View Ledger'), function() { frappe.route_options = { "voucher_no": doc.name, "from_date": doc.posting_date, diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 1f4218e427..69e5873de6 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -31,7 +31,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ frappe.boot.doctype_icons["Journal Voucher"]); if(doc.docstatus==1) { - cur_frm.appframe.add_button(__('View Ledger'), function() { + cur_frm.add_custom_button(__('View Ledger'), function() { frappe.route_options = { "voucher_no": doc.name, "from_date": doc.posting_date, diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 03d9d03724..f376126eef 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -49,7 +49,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte cur_frm.dashboard.reset(); if(doc.docstatus==1) { - cur_frm.appframe.add_button('View Ledger', function() { + cur_frm.add_custom_button('View Ledger', function() { frappe.route_options = { "voucher_no": doc.name, "from_date": doc.posting_date, @@ -60,10 +60,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte frappe.set_route("query-report", "General Ledger"); }, "icon-table"); - var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100); - cur_frm.dashboard.add_progress(percent_paid + "% Paid", percent_paid); + // var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100); + // cur_frm.dashboard.add_progress(percent_paid + "% Paid", percent_paid); - cur_frm.appframe.add_button(__('Send SMS'), cur_frm.cscript.send_sms, 'icon-mobile-phone'); + cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, 'icon-mobile-phone'); if(cint(doc.update_stock)!=1) { // show Make Delivery Note button only if Sales Invoice is not created from Delivery Note diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index ba45928ede..05e486688c 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -85,9 +85,6 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){ cur_frm.toggle_enable("exp_approver", doc.approval_status=="Draft"); cur_frm.toggle_enable("approval_status", (doc.exp_approver==user && doc.docstatus==0)); - if(!doc.__islocal && user!=doc.exp_approver) - cur_frm.frm_head.appframe.set_title_right(""); - if(doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved") cur_frm.savesubmit(); @@ -159,4 +156,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { if(cint(frappe.boot.notification_settings && frappe.boot.notification_settings.expense_claim)) { cur_frm.email_doc(frappe.boot.notification_settings.expense_claim_message); } -} \ No newline at end of file +} diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js index ecaac4ac37..1b6186fa89 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.js +++ b/erpnext/hr/doctype/leave_application/leave_application.js @@ -35,9 +35,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { } else { cur_frm.set_intro(__("This Leave Application is pending approval. Only the Leave Apporver can update status.")) cur_frm.toggle_enable("status", false); - if(!doc.__islocal) { - cur_frm.frm_head.appframe.set_title_right(""); - } } } else { if(doc.status=="Approved") { diff --git a/erpnext/public/js/controllers/stock_controller.js b/erpnext/public/js/controllers/stock_controller.js index 1b472f1d34..98caf435bb 100644 --- a/erpnext/public/js/controllers/stock_controller.js +++ b/erpnext/public/js/controllers/stock_controller.js @@ -43,7 +43,7 @@ erpnext.stock.StockController = frappe.ui.form.Controller.extend({ show_stock_ledger: function() { var me = this; if(this.frm.doc.docstatus===1) { - this.frm.appframe.add_button(__("Stock Ledger"), function() { + cur_frm.add_custom_button(__("Stock Ledger"), function() { frappe.route_options = { voucher_no: me.frm.doc.name, from_date: me.frm.doc.posting_date, @@ -59,7 +59,7 @@ erpnext.stock.StockController = frappe.ui.form.Controller.extend({ show_general_ledger: function() { var me = this; if(this.frm.doc.docstatus===1 && cint(frappe.defaults.get_default("auto_accounting_for_stock"))) { - cur_frm.appframe.add_button(__('Accounting Ledger'), function() { + cur_frm.add_custom_button(__('Accounting Ledger'), function() { frappe.route_options = { voucher_no: me.frm.doc.name, from_date: me.frm.doc.posting_date, diff --git a/erpnext/selling/doctype/lead/lead.js b/erpnext/selling/doctype/lead/lead.js index 0dae099e83..170e718654 100644 --- a/erpnext/selling/doctype/lead/lead.js +++ b/erpnext/selling/doctype/lead/lead.js @@ -31,7 +31,7 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({ frappe.boot.doctype_icons["Customer"], "btn-default"); this.frm.add_custom_button(__("Create Opportunity"), this.create_opportunity, frappe.boot.doctype_icons["Opportunity"], "btn-default"); - this.frm.appframe.add_button(__("Send SMS"), this.frm.cscript.send_sms, "icon-mobile-phone"); + cur_frm.add_custom_button(__("Send SMS"), this.frm.cscript.send_sms, "icon-mobile-phone"); } if(!this.frm.doc.__islocal) { diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 857a259129..0026582967 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -32,7 +32,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ cur_frm.add_custom_button(__('Set as Lost'), cur_frm.cscript['Declare Order Lost'], "icon-exclamation", "btn-default"); } - cur_frm.appframe.add_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone"); + cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone"); } if (this.frm.doc.docstatus===0) { diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js index f7ffe5ee49..3bb6c1767f 100644 --- a/erpnext/setup/doctype/item_group/item_group.js +++ b/erpnext/setup/doctype/item_group/item_group.js @@ -5,7 +5,7 @@ cur_frm.list_route = "Sales Browser/Item Group"; cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.set_root_readonly(doc); - cur_frm.appframe.add_button(__("Item Group Tree"), function() { + cur_frm.add_custom_button(__("Item Group Tree"), function() { frappe.set_route("Sales Browser", "Item Group"); }, "icon-sitemap") } diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 009ac4c764..6abc268f4a 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -32,7 +32,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend( cur_frm.add_custom_button(__('Make Installation Note'), this.make_installation_note); if (doc.docstatus==1) { - cur_frm.appframe.add_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone"); + cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone"); this.show_stock_ledger(); this.show_general_ledger(); } diff --git a/erpnext/templates/form_grid/item_grid.html b/erpnext/templates/form_grid/item_grid.html index 21903c03d0..2803550484 100644 --- a/erpnext/templates/form_grid/item_grid.html +++ b/erpnext/templates/form_grid/item_grid.html @@ -2,7 +2,7 @@ {% if(!doc) { %}
-
{%= __("Item") %}
+
{%= __("Items") %}
{%= __("Qty") %}
{%= __("Rate") %}
{%= __("Amount") %}
@@ -14,13 +14,36 @@
{%= doc.item_name %}{% } %} {% if(doc.item_name != doc.description) { %}

{%= doc.description %}

{% } %} - {% if(doc.sales_order || doc.against_sales_order) { %} -

- - {%= doc.sales_order || doc.against_sales_order %} -

- {% } %} +
+ {% if(doc.sales_order || doc.against_sales_order) { %} + + + {%= doc.sales_order || doc.against_sales_order %} + + {% } %} + {% if(doc.warehouse) { + var label_class = "label-default", + title = "Warehouse", + actual_qty = (doc.doctype==="Sales Order" + ? doc.projected_qty : doc.actual_qty); + if(actual_qty != undefined) { + if(actual_qty > doc.qty) { + var label_class = "label-success"; + var title = "In Stock" + } else { + var title = "Not In Stock" + } + } + %} + + + {%= doc.warehouse %} + + + {% } %} +
{% include "templates/form_grid/includes/visible_cols.html" %} {% if(doc.schedule_date) { %}
doc.qty) { - var label_class = "label-success"; - var title = "In Stock" - } else { - var title = "Not In Stock" - } - } - %} -
- - {%= doc.warehouse %} - -
- {% } %}