From e23e99f4bd2288b0890da32efa190e9018ec52e8 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 6 Jan 2016 15:34:56 +0530 Subject: [PATCH] [enhance] merge customize buttons under groups --- erpnext/accounts/doctype/account/account.js | 10 ++-- .../doctype/cost_center/cost_center.js | 8 +-- .../doctype/fiscal_year/fiscal_year.js | 2 +- .../doctype/journal_entry/journal_entry.js | 2 +- .../purchase_invoice/purchase_invoice.js | 9 +-- .../doctype/sales_invoice/sales_invoice.js | 13 +++-- .../purchase_common/purchase_common.js | 4 +- .../doctype/purchase_order/purchase_order.js | 58 ++++++++++--------- .../supplier_quotation/supplier_quotation.js | 9 +-- erpnext/crm/doctype/lead/lead.js | 10 ++-- .../newsletter_list/newsletter_list.js | 8 +-- .../crm/doctype/opportunity/opportunity.js | 23 ++++---- erpnext/hr/doctype/employee/employee.js | 5 +- .../hr/doctype/expense_claim/expense_claim.js | 5 +- .../hr/doctype/job_applicant/job_applicant.js | 9 +-- .../salary_structure/salary_structure.js | 5 +- .../production_order/production_order.js | 31 +++++----- erpnext/projects/doctype/project/project.js | 8 +-- erpnext/projects/doctype/task/task.js | 8 +-- .../public/js/controllers/stock_controller.js | 4 +- erpnext/public/js/controllers/transaction.js | 4 +- .../selling/doctype/quotation/quotation.js | 11 ++-- .../doctype/sales_order/sales_order.js | 2 +- .../doctype/delivery_note/delivery_note.js | 31 ++++++---- erpnext/stock/doctype/item/item.js | 15 ++--- .../material_request/material_request.js | 21 ++++--- .../purchase_receipt/purchase_receipt.js | 22 +++---- .../stock/doctype/stock_entry/stock_entry.js | 5 +- .../stock_reconciliation.js | 2 +- erpnext/support/doctype/issue/issue.js | 4 +- .../maintenance_schedule.js | 6 +- .../maintenance_visit/maintenance_visit.js | 12 ++-- .../doctype/warranty_claim/warranty_claim.js | 5 +- 33 files changed, 195 insertions(+), 176 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js index a2eb714f33..703397e52a 100644 --- a/erpnext/accounts/doctype/account/account.js +++ b/erpnext/accounts/doctype/account/account.js @@ -48,13 +48,13 @@ cur_frm.cscript.account_type = function(doc, cdt, cdn) { cur_frm.cscript.add_toolbar_buttons = function(doc) { cur_frm.add_custom_button(__('Chart of Accounts'), - function() { frappe.set_route("Accounts Browser", "Account"); }, 'icon-sitemap') + function() { frappe.set_route("Accounts Browser", "Account"); }, __("View")) if (doc.is_group == 1) { - cur_frm.add_custom_button(__('Convert to non-Group'), + cur_frm.add_custom_button(__('Group to Non-Group'), function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet', 'btn-default'); } else if (cint(doc.is_group) == 0) { - cur_frm.add_custom_button(__('View Ledger'), function() { + cur_frm.add_custom_button(__('Ledger'), function() { frappe.route_options = { "account": doc.name, "from_date": sys_defaults.year_start_date, @@ -62,9 +62,9 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) { "company": doc.company }; frappe.set_route("query-report", "General Ledger"); - }, "icon-table"); + }, __("View")); - cur_frm.add_custom_button(__('Convert to Group'), + cur_frm.add_custom_button(__('Group to Group'), function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet', 'btn-default') } } diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js index e4db510cad..f66459be18 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.set_intro(intro_txt); cur_frm.add_custom_button(__('Chart of Cost Centers'), - function() { frappe.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap') + function() { frappe.set_route("Accounts Browser", "Cost Center"); }, __("View")) } cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) { @@ -62,12 +62,12 @@ cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) { cur_frm.cscript.hide_unhide_group_ledger = function(doc) { if (doc.is_group == 1) { - cur_frm.add_custom_button(__('Convert to non-Group'), - function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet', + cur_frm.add_custom_button(__('Convert to Non-Group'), + function() { cur_frm.cscript.convert_to_ledger(); }, "icon-retweet", "btn-default") } else if (doc.is_group == 0) { cur_frm.add_custom_button(__('Convert to Group'), - function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet', + function() { cur_frm.cscript.convert_to_group(); }, "icon-retweet", "btn-default") } } diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js index cca01a408b..e7812c38ce 100644 --- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js +++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js @@ -14,7 +14,7 @@ $.extend(cur_frm.cscript, { this.frm.toggle_enable('year_end_date', doc.__islocal) if (!doc.__islocal && (doc.name != sys_defaults.fiscal_year)) { - this.frm.add_custom_button(__("Set as Default"), + this.frm.add_custom_button(__("Default"), this.frm.cscript.set_as_default, "icon-star"); this.frm.set_intro(__("To set this Fiscal Year as Default, click on 'Set as Default'")); } else { diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index dc24522926..76f6ee5ad4 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -11,7 +11,7 @@ frappe.ui.form.on("Journal Entry", { frm.cscript.voucher_type(frm.doc); if(frm.doc.docstatus==1) { - frm.add_custom_button(__('View Ledger'), function() { + frm.add_custom_button(__('Ledger'), function() { frappe.route_options = { "voucher_no": frm.doc.name, "from_date": frm.doc.posting_date, diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 6eb29fa55b..4a52541fe6 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -25,13 +25,14 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ if(!doc.is_return) { if(doc.docstatus==1) { if(doc.outstanding_amount != 0) { - this.frm.add_custom_button(__('Payment'), this.make_bank_entry).addClass("btn-primary"); + this.frm.add_custom_button(__('Payment'), this.make_bank_entry, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } - cur_frm.add_custom_button(__('Debit Note'), this.make_debit_note); + cur_frm.add_custom_button(__('Debit Note'), this.make_debit_note, __("Make")); } if(doc.docstatus===0) { - cur_frm.add_custom_button(__('From Purchase Order'), function() { + cur_frm.add_custom_button(__('Purchase Order'), function() { frappe.model.map_current_doc({ method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice", source_doctype: "Purchase Order", @@ -45,7 +46,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ }) }); - cur_frm.add_custom_button(__('From Purchase Receipt'), function() { + cur_frm.add_custom_button(__('Purchase Receipt'), function() { frappe.model.map_current_doc({ method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice", source_doctype: "Purchase Receipt", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 6b03afa3ee..3c8673cc65 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -58,7 +58,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }) cur_frm.add_custom_button(doc.update_stock ? __('Sales Return') : __('Credit Note'), - this.make_sales_return); + this.make_sales_return, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); if(cint(doc.update_stock)!=1) { // show Make Delivery Note button only if Sales Invoice is not created from Delivery Note @@ -69,13 +70,13 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }); if(!from_delivery_note && !is_delivered_by_supplier) { - cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note']).addClass("btn-primary"); + cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note'], __("Make")); } } if(doc.outstanding_amount!=0 && !cint(doc.is_return)) { - cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry).addClass("btn-primary"); - cur_frm.add_custom_button(__('Make Payment Request'), this.make_payment_request); + cur_frm.add_custom_button(__('Make Payment Request'), this.make_payment_request, __("Make")); + cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry, __("Make")); } } @@ -118,7 +119,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte company: cur_frm.doc.company } }) - }); + }, __("From")); }, delivery_note_btn: function() { @@ -138,7 +139,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }; } }); - }); + }, __("From")); }, tc_name: function() { diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 0860bca37c..85ce5b427c 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -167,9 +167,9 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ set_from_product_bundle: function() { var me = this; - this.frm.add_custom_button(__("From Product Bundle"), function() { + this.frm.add_custom_button(__("Product Bundle"), function() { erpnext.buying.get_items_from_product_bundle(me.frm); - }); + }, __("From")); } }); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index ba215c1572..db7a544c54 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -37,49 +37,54 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( } cur_frm.set_df_property("drop_ship", "hidden", !is_drop_ship); - + if(doc.docstatus == 1 && !in_list(["Stopped", "Closed", "Delivered"], doc.status)) { if (this.frm.has_perm("submit")) { if(flt(doc.per_billed, 2) < 100 || doc.per_received < 100) { - cur_frm.add_custom_button(__('Stop'), this.stop_purchase_order); + cur_frm.add_custom_button(__('Stop'), this.stop_purchase_order, __("Status")); } - cur_frm.add_custom_button(__('Close'), this.close_purchase_order); - } - - if(flt(doc.per_billed)==0) { - cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry); + cur_frm.add_custom_button(__('Close'), this.close_purchase_order, __("Status")); } + if(is_drop_ship && doc.status!="Delivered"){ - cur_frm.add_custom_button(__('Mark as Delivered'), - this.delivered_by_supplier).addClass("btn-primary"); + cur_frm.add_custom_button(__('Delivered'), + this.delivered_by_supplier, __("Status")); + + cur_frm.page.set_inner_btn_group_as_primary(__("Status")); } } else if(doc.docstatus===0) { cur_frm.add_custom_button(__('Get Last Purchase Rate'), this.get_last_purchase_rate); cur_frm.cscript.add_from_mappers(); } - + + if(doc.docstatus == 1 && in_list(["Stopped", "Closed", "Delivered"], doc.status)) { + if (this.frm.has_perm("submit")) { + cur_frm.add_custom_button(__('Re-open'), this.unstop_purchase_order, __("Status")); + } + } + if(doc.docstatus == 1 && !in_list(["Stopped", "Closed"], doc.status)) { if(flt(doc.per_received, 2) < 100 && allow_receipt) { - cur_frm.add_custom_button(__('Receive'), this.make_purchase_receipt).addClass("btn-primary"); + cur_frm.add_custom_button(__('Receive'), this.make_purchase_receipt, __("Make")); if(doc.is_subcontracted==="Yes") { - cur_frm.add_custom_button(__('Transfer Material to Supplier'), - function() { me.make_stock_entry(); }); + cur_frm.add_custom_button(__('Material to Supplier'), + function() { me.make_stock_entry(); }, __("Transfer")); } } if(flt(doc.per_billed, 2) < 100) cur_frm.add_custom_button(__('Invoice'), - this.make_purchase_invoice).addClass("btn-primary"); - } - - if(doc.docstatus == 1 && in_list(["Stopped", "Closed", "Delivered"], doc.status)) { - if (this.frm.has_perm("submit")) { - cur_frm.add_custom_button(__('Re-open'), this.unstop_purchase_order).addClass("btn-primary"); + this.make_purchase_invoice, __("Make")); + + if(flt(doc.per_billed)==0 && doc.status != "Delivered") { + cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry, __("Make")); } + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); + } }, @@ -126,7 +131,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( }, add_from_mappers: function() { - cur_frm.add_custom_button(__('From Material Request'), + cur_frm.add_custom_button(__('Material Request'), function() { frappe.model.map_current_doc({ method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order", @@ -139,10 +144,9 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( company: cur_frm.doc.company } }) - } - ); + }, __("From")); - cur_frm.add_custom_button(__('From Supplier Quotation'), + cur_frm.add_custom_button(__('Supplier Quotation'), function() { frappe.model.map_current_doc({ method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order", @@ -153,10 +157,9 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( company: cur_frm.doc.company } }) - } - ); + }, __("From")); - cur_frm.add_custom_button(__('For Supplier'), + cur_frm.add_custom_button(__('Supplier'), function() { frappe.model.map_current_doc({ method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order_based_on_supplier", @@ -165,8 +168,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( docstatus: ["!=", 2], } }) - } - ); + }, __("For")); }, tc_name: function() { diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js index 67c8795170..89220489f4 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -9,11 +9,12 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext this._super(); if (this.frm.doc.docstatus === 1) { - cur_frm.add_custom_button(__("Make Purchase Order"), this.make_purchase_order, - frappe.boot.doctype_icons["Journal Entry"]); + cur_frm.add_custom_button(__("Purchase Order"), this.make_purchase_order, + __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } else if (this.frm.doc.docstatus===0) { - cur_frm.add_custom_button(__('From Material Request'), + cur_frm.add_custom_button(__('Material Request'), function() { frappe.model.map_current_doc({ method: "erpnext.stock.doctype.material_request.material_request.make_supplier_quotation", @@ -26,7 +27,7 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext company: cur_frm.doc.company } }) - }, "icon-download", "btn-default"); + }, __("From")); } }, diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js index 1dc8eb2579..25d758866f 100644 --- a/erpnext/crm/doctype/lead/lead.js +++ b/erpnext/crm/doctype/lead/lead.js @@ -27,12 +27,10 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({ erpnext.toggle_naming_series(); if(!this.frm.doc.__islocal && this.frm.doc.__onload && !this.frm.doc.__onload.is_customer) { - this.frm.add_custom_button(__("Create Customer"), this.create_customer, - 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.add_custom_button(__("Make Quotation"), this.make_quotation, - frappe.boot.doctype_icons["Quotation"], "btn-default"); + this.frm.add_custom_button(__("Customer"), this.create_customer, __("Make")); + this.frm.add_custom_button(__("Opportunity"), this.create_opportunity, __("Make")); + this.frm.add_custom_button(__("Make Quotation"), this.make_quotation, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } if(!this.frm.doc.__islocal) { diff --git a/erpnext/crm/doctype/newsletter_list/newsletter_list.js b/erpnext/crm/doctype/newsletter_list/newsletter_list.js index ed0ac5e210..d6cda45a0a 100644 --- a/erpnext/crm/doctype/newsletter_list/newsletter_list.js +++ b/erpnext/crm/doctype/newsletter_list/newsletter_list.js @@ -3,7 +3,7 @@ frappe.ui.form.on("Newsletter List", "refresh", function(frm) { frm.add_custom_button(__("View Subscribers"), function() { frappe.route_options = {"newsletter_list": frm.doc.name}; frappe.set_route("Report", "Newsletter List Subscriber"); - }); + }, __("View")); frm.add_custom_button(__("Import Subscribers"), function() { frappe.prompt({fieldtype:"Select", options: frm.doc.__onload.import_types, @@ -19,7 +19,7 @@ frappe.ui.form.on("Newsletter List", "refresh", function(frm) { } }) }, __("Import Subscribers"), __("Import")); - }); + }, __("Action")); frm.add_custom_button(__("Add Subscribers"), function() { frappe.prompt({fieldtype:"Text", @@ -35,12 +35,12 @@ frappe.ui.form.on("Newsletter List", "refresh", function(frm) { } }) }, __("Add Subscribers"), __("Add")); - }); + }, __("Action")); frm.add_custom_button(__("New Newsletter"), function() { frappe.route_options = {"newsletter_list": frm.doc.name}; new_doc("Newsletter"); - }); + }, __("Action")); } }); diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index 43e2dd5872..b6abdaf3ac 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -78,29 +78,30 @@ $.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm})); cur_frm.cscript.refresh = function(doc, cdt, cdn) { erpnext.toggle_naming_series(); - if(doc.status!=="Lost") { - cur_frm.add_custom_button(__('Create Quotation'), - cur_frm.cscript.create_quotation, frappe.boot.doctype_icons["Quotation"], - "btn-default"); - if(doc.status!=="Quotation") - cur_frm.add_custom_button(__('Opportunity Lost'), - cur_frm.cscript['Declare Opportunity Lost'], "icon-remove", "btn-default"); - } - var frm = cur_frm; if(frm.perm[0].write && doc.docstatus==0) { if(frm.doc.status==="Open") { frm.add_custom_button(__("Close"), function() { frm.set_value("status", "Closed"); frm.save(); - }); + }, __("Status")); } else { frm.add_custom_button(__("Reopen"), function() { frm.set_value("status", "Open"); frm.save(); - }); + }, __("Status")); } } + + if(doc.status!=="Lost") { + if(doc.status!=="Quotation") { + cur_frm.add_custom_button(__('Opportunity Lost'), + cur_frm.cscript['Declare Opportunity Lost'], __("Mark")); + } + + cur_frm.add_custom_button(__('Quotation'),cur_frm.cscript.create_quotation, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); + } } diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js index 39af40e886..8a20a09cdd 100644 --- a/erpnext/hr/doctype/employee/employee.js +++ b/erpnext/hr/doctype/employee/employee.js @@ -24,8 +24,9 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({ erpnext.toggle_naming_series(); if(!this.frm.doc.__islocal && this.frm.doc.__onload && !this.frm.doc.__onload.salary_structure_exists) { - cur_frm.add_custom_button(__('Make Salary Structure'), function() { - me.make_salary_structure(this); }, frappe.boot.doctype_icons["Salary Structure"]); + cur_frm.add_custom_button(__('Salary Structure'), function() { + me.make_salary_structure(this); }, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } }, diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index 780cd70612..85cd38df41 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -97,8 +97,9 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){ if(doc.docstatus==1 && frappe.model.can_create("Journal Entry") && cint(doc.total_amount_reimbursed) < cint(doc.total_sanctioned_amount)) - cur_frm.add_custom_button(__("Make Bank Entry"), - cur_frm.cscript.make_bank_entry, frappe.boot.doctype_icons["Journal Entry"]); + cur_frm.add_custom_button(__("Bank Entry"), + cur_frm.cscript.make_bank_entry, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } } diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.js b/erpnext/hr/doctype/job_applicant/job_applicant.js index 1ca750ad15..eac1a9add1 100644 --- a/erpnext/hr/doctype/job_applicant/job_applicant.js +++ b/erpnext/hr/doctype/job_applicant/job_applicant.js @@ -10,18 +10,19 @@ frappe.ui.form.on("Job Applicant", { refresh: function(frm) { if (!frm.doc.__islocal) { if (frm.doc.__onload && frm.doc.__onload.offer_letter) { - frm.add_custom_button(__("View Offer Letter"), function() { + frm.add_custom_button(__("Offer Letter"), function() { frappe.set_route("Form", "Offer Letter", frm.doc.__onload.offer_letter); - }); + }, __("View")); } else { - frm.add_custom_button(__("Make Offer Letter"), function() { + frm.add_custom_button(__("Offer Letter"), function() { frappe.route_options = { "job_applicant": frm.doc.name, "applicant_name": frm.doc.applicant_name, "designation": frm.doc.job_opening, }; new_doc("Offer Letter"); - }); + }, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } } diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js index 995c744edf..65aac1bf60 100644 --- a/erpnext/hr/doctype/salary_structure/salary_structure.js +++ b/erpnext/hr/doctype/salary_structure/salary_structure.js @@ -12,8 +12,9 @@ cur_frm.cscript.onload = function(doc, dt, dn){ cur_frm.cscript.refresh = function(doc, dt, dn){ if((!doc.__islocal) && (doc.is_active == 'Yes')){ - cur_frm.add_custom_button(__('Make Salary Slip'), - cur_frm.cscript['Make Salary Slip'], frappe.boot.doctype_icons["Salary Slip"]); + cur_frm.add_custom_button(__('Salary Slip'), + cur_frm.cscript['Make Salary Slip'], __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } } diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index 7349447ffd..73823e8f74 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -61,30 +61,17 @@ erpnext.production_order = { set_custom_buttons: function(frm) { var doc = frm.doc; if (doc.docstatus === 1) { - - if (flt(doc.material_transferred_for_manufacturing) < flt(doc.qty)) { - frm.add_custom_button(__('Transfer Materials for Manufacture'), - cur_frm.cscript['Transfer Raw Materials'], frappe.boot.doctype_icons["Stock Entry"]); - } - - if (flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing)) { - frm.add_custom_button(__('Update Finished Goods'), - cur_frm.cscript['Update Finished Goods'], frappe.boot.doctype_icons["Stock Entry"]); - } - frm.add_custom_button(__("Show Stock Entries"), function() { frappe.route_options = { production_order: frm.doc.name } frappe.set_route("List", "Stock Entry"); - }); + }, __("View")); if (doc.status != 'Stopped' && doc.status != 'Completed') { - frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Production Order'], - "icon-exclamation", "btn-default"); + frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Production Order'], __("Status")); } else if (doc.status == 'Stopped') { - frm.add_custom_button(__('Re-open'), cur_frm.cscript['Unstop Production Order'], - "icon-check", "btn-default"); + frm.add_custom_button(__('Re-open'), cur_frm.cscript['Unstop Production Order'], __("Status")); } // opertions @@ -92,7 +79,17 @@ erpnext.production_order = { frm.add_custom_button(__('Show Time Logs'), function() { frappe.route_options = {"production_order": frm.doc.name}; frappe.set_route("List", "Time Log"); - }); + }, __("View")); + } + + if (flt(doc.material_transferred_for_manufacturing) < flt(doc.qty)) { + frm.add_custom_button(__('Transfer Materials for Manufacture'), + cur_frm.cscript['Transfer Raw Materials'], __("Stock Entry")); + } + + if (flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing)) { + frm.add_custom_button(__('Update Finished Goods'), + cur_frm.cscript['Update Finished Goods'], __("Stock Entry")); } } diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js index 8c143478d3..b33386b862 100644 --- a/erpnext/projects/doctype/project/project.js +++ b/erpnext/projects/doctype/project/project.js @@ -30,24 +30,24 @@ cur_frm.cscript.refresh = function(doc) { cur_frm.add_custom_button(__("Gantt Chart"), function() { frappe.route_options = {"project": doc.name, "start": doc.expected_start_date, "end": doc.expected_end_date}; frappe.set_route("Gantt", "Task"); - }, "icon-tasks", true); + }, __("View"), true); cur_frm.add_custom_button(__("Tasks"), function() { frappe.route_options = {"project": doc.name} frappe.set_route("List", "Task"); - }, "icon-list", true); + }, __("View"), true); } if(frappe.model.can_read("Time Log")) { cur_frm.add_custom_button(__("Time Logs"), function() { frappe.route_options = {"project": doc.name} frappe.set_route("List", "Time Log"); - }, "icon-list", true); + }, __("View"), true); } if(frappe.model.can_read("Expense Claim")) { cur_frm.add_custom_button(__("Expense Claims"), function() { frappe.route_options = {"project": doc.name} frappe.set_route("List", "Expense Claim"); - }, "icon-list", true); + }, __("View"), true); } } } diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js index 18f5ca06c8..a0bbe26cec 100644 --- a/erpnext/projects/doctype/task/task.js +++ b/erpnext/projects/doctype/task/task.js @@ -20,13 +20,13 @@ frappe.ui.form.on("Task", { frm.add_custom_button(__("Time Logs"), function() { frappe.route_options = {"project": doc.project, "task": doc.name} frappe.set_route("List", "Time Log"); - }, "icon-list", true); + }, __("View"), true); } if(frappe.model.can_read("Expense Claim")) { frm.add_custom_button(__("Expense Claims"), function() { frappe.route_options = {"project": doc.project, "task": doc.name} frappe.set_route("List", "Expense Claim"); - }, "icon-list", true); + }, __("View"), true); } if(frm.perm[0].write) { @@ -34,12 +34,12 @@ frappe.ui.form.on("Task", { frm.add_custom_button(__("Close"), function() { frm.set_value("status", "Closed"); frm.save(); - }); + }, __("Status")); } else { frm.add_custom_button(__("Reopen"), function() { frm.set_value("status", "Open"); frm.save(); - }); + }, __("Status")); } } } diff --git a/erpnext/public/js/controllers/stock_controller.js b/erpnext/public/js/controllers/stock_controller.js index 9df7d0f5d8..a360d919be 100644 --- a/erpnext/public/js/controllers/stock_controller.js +++ b/erpnext/public/js/controllers/stock_controller.js @@ -29,7 +29,7 @@ erpnext.stock.StockController = frappe.ui.form.Controller.extend({ company: me.frm.doc.company }; frappe.set_route("query-report", "Stock Ledger"); - }, "icon-bar-chart"); + }, __("View")); } }, @@ -46,7 +46,7 @@ erpnext.stock.StockController = frappe.ui.form.Controller.extend({ group_by_voucher: false }; frappe.set_route("query-report", "General Ledger"); - }, "icon-table"); + }, __("View")); } } }); diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index d3fa0a8c1e..d768306101 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -133,14 +133,14 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ var me = this; if (in_list(["Purchase Invoice", "Sales Invoice"], this.frm.doctype)) { if(this.frm.doc.outstanding_amount !== this.frm.doc.base_grand_total) { - this.frm.add_custom_button(__("Show Payments"), function() { + this.frm.add_custom_button(__("Payments"), function() { frappe.route_options = { "Journal Entry Account.reference_type": me.frm.doc.doctype, "Journal Entry Account.reference_name": me.frm.doc.name }; frappe.set_route("List", "Journal Entry"); - }); + }, __("View")); } } }, diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index d717e20675..8d1df4c2a1 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -18,11 +18,12 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ this._super(doc, dt, dn); if(doc.docstatus == 1 && doc.status!=='Lost') { - cur_frm.add_custom_button(__('Make Sales Order'), - cur_frm.cscript['Make Sales Order'], frappe.boot.doctype_icons["Sales Order"]); + cur_frm.add_custom_button(__('Sales Order'), + cur_frm.cscript['Make Sales Order'], __("Make")); + if(doc.status!=="Ordered") { - cur_frm.add_custom_button(__('Set as Lost'), - cur_frm.cscript['Declare Order Lost'], "icon-exclamation", "btn-default"); + cur_frm.add_custom_button(__('Lost'), + cur_frm.cscript['Declare Order Lost'], __("Mark")); } } @@ -41,7 +42,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ company: cur_frm.doc.company } }) - }, "icon-download", "btn-default"); + }, __("From"), "btn-default"); } this.toggle_reqd_lead_customer(); diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 74b52027c5..a6ec617646 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -54,7 +54,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( // delivery note if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1 && allow_delivery) { cur_frm.add_custom_button(__('Delivery'), this.make_delivery_note, __("Make")); - // cur_frm.page.set_inner_btn_group_as_primary(__("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } // sales invoice diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index c5a3bab06e..84e9d8dd52 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -11,19 +11,20 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend( if (!doc.is_return && doc.status!="Closed") { if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1) - cur_frm.add_custom_button(__('Installation Note'), this.make_installation_note); + cur_frm.add_custom_button(__('Installation Note'), this.make_installation_note, __("Make")); if (doc.docstatus==1) { - cur_frm.add_custom_button(__('Sales Return'), this.make_sales_return); + cur_frm.add_custom_button(__('Sales Return'), this.make_sales_return, __("Make")); } if(doc.docstatus==0 && !doc.__islocal) { cur_frm.add_custom_button(__('Packing Slip'), - cur_frm.cscript['Make Packing Slip'], frappe.boot.doctype_icons["Packing Slip"]); + cur_frm.cscript['Make Packing Slip'], __("Make")); } - + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); + if (this.frm.doc.docstatus===0) { - cur_frm.add_custom_button(__('From Sales Order'), + cur_frm.add_custom_button(__('Sales Order'), function() { frappe.model.map_current_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_delivery_note", @@ -37,7 +38,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend( company: cur_frm.doc.company } }) - }); + }, __("From")); } } @@ -47,17 +48,25 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend( this.show_general_ledger(); } if (this.frm.has_perm("submit") && (doc.status !== "Closed") - && this.frm.doc.__onload && !this.frm.doc.__onload.has_return_entry) { - cur_frm.add_custom_button(__("Close"), this.close_delivery_note) + && this.frm.doc.__onload && this.frm.doc.__onload.has_return_entry) { + cur_frm.add_custom_button(__("Close"), this.close_delivery_note, __("Status")) } } - if(doc.docstatus==1 && !doc.is_return && doc.status!="Closed" && flt(doc.per_billed, 2) < 100) { - cur_frm.add_custom_button(__('Invoice'), this.make_sales_invoice).addClass("btn-primary"); + if(doc.__onload && !doc.__onload.billing_complete && doc.docstatus==1 + && !doc.is_return && doc.status!="Closed") { + // show Make Invoice button only if Delivery Note is not created from Sales Invoice + var from_sales_invoice = false; + from_sales_invoice = cur_frm.doc.items.some(function(item) { + return item.against_sales_invoice ? true : false; + }); + + if(!from_sales_invoice) + cur_frm.add_custom_button(__('Invoice'), this.make_sales_invoice, __("Make")); } if(doc.docstatus==1 && doc.status === "Closed" && this.frm.has_perm("submit")) { - cur_frm.add_custom_button(__('Reopen'), this.reopen_delivery_note) + cur_frm.add_custom_button(__('Reopen'), this.reopen_delivery_note, __("Status")) } erpnext.stock.delivery_note.set_print_hide(doc, dt, dn); diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index 2caade633c..f6b424c3aa 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -22,19 +22,19 @@ frappe.ui.form.on("Item", { "item_code": frm.doc.name } frappe.set_route("query-report", "Stock Balance"); - }); + }, __("View")); frm.add_custom_button(__("Ledger"), function() { frappe.route_options = { "item_code": frm.doc.name } frappe.set_route("query-report", "Stock Ledger"); - }); + }, __("View")); frm.add_custom_button(__("Projected"), function() { frappe.route_options = { "item_code": frm.doc.name } frappe.set_route("query-report", "Stock Projected Qty"); - }); + }, __("View")); } // make sensitive fields(has_serial_no, is_stock_item, valuation_method) @@ -48,11 +48,12 @@ frappe.ui.form.on("Item", { frm.set_intro(__("This Item is a Template and cannot be used in transactions. Item attributes will be copied over into the variants unless 'No Copy' is set"), true); frm.add_custom_button(__("Show Variants"), function() { frappe.set_route("List", "Item", {"variant_of": frm.doc.name}); - }, "icon-list", "btn-default"); + }, __("View")); - frm.add_custom_button(__("Make Variant"), function() { + frm.add_custom_button(__("Variant"), function() { erpnext.item.make_variant() - }, "icon-list", "btn-default"); + }, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } if (frm.doc.variant_of) { frm.set_intro(__("This Item is a Variant of {0} (Template). Attributes will be copied over from the template unless 'No Copy' is set", [frm.doc.variant_of]), true); @@ -192,7 +193,7 @@ $.extend(erpnext.item, { edit_prices_button: function(frm) { frm.add_custom_button(__("Add / Edit Prices"), function() { frappe.set_route("Report", "Item Price", {"item_code": frm.doc.name}); - }, "icon-money", "btn-default"); + }, __("View")); }, weight_to_validate: function(frm){ diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index 3ce6707dcf..d5df93ff89 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -36,30 +36,29 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten if(doc.docstatus == 1 && doc.status != 'Stopped') { if(doc.material_request_type === "Purchase") cur_frm.add_custom_button(__("Make Supplier Quotation"), - this.make_supplier_quotation, - frappe.boot.doctype_icons["Supplier Quotation"]); + this.make_supplier_quotation, __("Make")); + + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); if(flt(doc.per_ordered, 2) < 100) { if(doc.material_request_type === "Material Transfer" && doc.status === "Submitted") - cur_frm.add_custom_button(__("Transfer Material"), this.make_stock_entry, - frappe.boot.doctype_icons["Stock Entry"]); + cur_frm.add_custom_button(__("Transfer Material"), this.make_stock_entry, __("Make")); if(doc.material_request_type === "Material Issue" && doc.status === "Submitted") - cur_frm.add_custom_button(__("Issue Material"), this.make_stock_entry, - frappe.boot.doctype_icons["Stock Entry"]); + cur_frm.add_custom_button(__("Issue Material"), this.make_stock_entry, __("Make")); if(doc.material_request_type === "Purchase") cur_frm.add_custom_button(__('Make Purchase Order'), - this.make_purchase_order, frappe.boot.doctype_icons["Purchase Order"]); + this.make_purchase_order, __("Make")); cur_frm.add_custom_button(__('Stop'), - cur_frm.cscript['Stop Material Request'], "icon-exclamation", "btn-default"); + cur_frm.cscript['Stop Material Request'], __("Status")); } } if (this.frm.doc.docstatus===0) { - cur_frm.add_custom_button(__('From Sales Order'), + cur_frm.add_custom_button(__('Sales Order'), function() { frappe.model.map_current_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_material_request", @@ -71,12 +70,12 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten company: cur_frm.doc.company } }) - }, "icon-download", "btn-default"); + }, __("From")); } if(doc.docstatus == 1 && doc.status == 'Stopped') cur_frm.add_custom_button(__('Re-open'), - cur_frm.cscript['Unstop Material Request'], "icon-check"); + cur_frm.cscript['Unstop Material Request'], __("Status")); }, diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index eec1a6d8b5..bda14ffbf1 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -38,7 +38,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend if(!this.frm.doc.is_return && this.frm.doc.status!="Closed") { if(this.frm.doc.docstatus==0) { - cur_frm.add_custom_button(__('From Purchase Order'), + cur_frm.add_custom_button(__('Purchase Order'), function() { frappe.model.map_current_doc({ method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt", @@ -51,25 +51,27 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend company: cur_frm.doc.company } }) - }); + }, __("From")); } if(this.frm.doc.docstatus == 1 && this.frm.doc.status!="Closed") { - cur_frm.add_custom_button(__('Return'), this.make_purchase_return); + if (this.frm.has_perm("submit") && + this.frm.doc.__onload && this.frm.doc.__onload.has_return_entry) { + cur_frm.add_custom_button(__("Close"), this.close_purchase_receipt, __("Status")) + } + + cur_frm.add_custom_button(__('Return'), this.make_purchase_return, __("Make")); + if(this.frm.doc.__onload && !this.frm.doc.__onload.billing_complete) { - cur_frm.add_custom_button(__('Invoice'), - this.make_purchase_invoice).addClass("btn-primary"); - } - if (this.frm.has_perm("submit") && - this.frm.doc.__onload && !this.frm.doc.__onload.has_return_entry) { - cur_frm.add_custom_button(__("Close"), this.close_purchase_receipt) + cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice, __("Make")); } + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } } if(this.frm.doc.docstatus==1 && this.frm.doc.status === "Closed" && this.frm.has_perm("submit")) { - cur_frm.add_custom_button(__('Reopen'), this.reopen_purchase_receipt) + cur_frm.add_custom_button(__('Reopen'), this.reopen_purchase_receipt, __("Status")) } this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted==="Yes"); diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 585f8dd55f..9d6f5900ad 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -176,12 +176,13 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ add_excise_button: function() { if(frappe.boot.sysdefaults.country === "India") - this.frm.add_custom_button(__("Make Excise Invoice"), function() { + this.frm.add_custom_button(__("Excise Invoice"), function() { var excise = frappe.model.make_new_doc_and_get_name('Journal Entry'); excise = locals['Journal Entry'][excise]; excise.voucher_type = 'Excise Entry'; loaddoc('Journal Entry', excise.name); - }, frappe.boot.doctype_icons["Journal Entry"], "btn-default"); + }, __("Make")); + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); }, items_add: function(doc, cdt, cdn) { diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js index 535e397c55..7d55d3c118 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js @@ -19,7 +19,7 @@ frappe.ui.form.on("Stock Reconciliation", { refresh: function(frm) { if(frm.doc.docstatus < 1) { - frm.add_custom_button(__("Get Items"), function() { + frm.add_custom_button(__("Items"), function() { frm.events.get_items(frm); }); } diff --git a/erpnext/support/doctype/issue/issue.js b/erpnext/support/doctype/issue/issue.js index 21ef5b8f3b..15029a06a7 100644 --- a/erpnext/support/doctype/issue/issue.js +++ b/erpnext/support/doctype/issue/issue.js @@ -8,12 +8,12 @@ frappe.ui.form.on("Issue", { frm.add_custom_button(__("Close"), function() { frm.set_value("status", "Closed"); frm.save(); - }); + }, __("Status")); } else { frm.add_custom_button(__("Reopen"), function() { frm.set_value("status", "Open"); frm.save(); - }); + }, __("Status")); } } }); diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js index 023ef6c8fa..b24ae4835c 100644 --- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js +++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js @@ -16,7 +16,7 @@ erpnext.support.MaintenanceSchedule = frappe.ui.form.Controller.extend({ var me = this; if (this.frm.doc.docstatus === 0) { - this.frm.add_custom_button(__('From Sales Order'), + this.frm.add_custom_button(__('Sales Order'), function() { frappe.model.map_current_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule", @@ -28,7 +28,7 @@ erpnext.support.MaintenanceSchedule = frappe.ui.form.Controller.extend({ company: me.frm.doc.company } }); - }, "icon-download", "btn-default"); + }, __("From")); } else if (this.frm.doc.docstatus === 1) { this.frm.add_custom_button(__("Make Maintenance Visit"), function() { frappe.model.open_mapped_doc({ @@ -36,7 +36,7 @@ erpnext.support.MaintenanceSchedule = frappe.ui.form.Controller.extend({ source_name: me.frm.doc.name, frm: me.frm }) - }, frappe.boot.doctype_icons["Maintenance Visit"]); + }, __("Make")); } }, diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js index 7a803fb665..91f7fa240d 100644 --- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js +++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js @@ -15,7 +15,7 @@ frappe.ui.form.on_change("Maintenance Visit", "contact_person", erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({ refresh: function() { if (this.frm.doc.docstatus===0) { - cur_frm.add_custom_button(__('From Maintenance Schedule'), + cur_frm.add_custom_button(__('Maintenance Schedule'), function() { frappe.model.map_current_doc({ method: "erpnext.support.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit", @@ -26,8 +26,8 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({ company: cur_frm.doc.company } }) - }, "icon-download", "btn-default"); - cur_frm.add_custom_button(__('From Warranty Claim'), + }, __("From")); + cur_frm.add_custom_button(__('Warranty Claim'), function() { frappe.model.map_current_doc({ method: "erpnext.support.doctype.warranty_claim.warranty_claim.make_maintenance_visit", @@ -38,8 +38,8 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({ company: cur_frm.doc.company } }) - }, "icon-download", "btn-default"); - cur_frm.add_custom_button(__('From Sales Order'), + }, __("From")); + cur_frm.add_custom_button(__('Sales Order'), function() { frappe.model.map_current_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit", @@ -51,7 +51,7 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({ company: cur_frm.doc.company } }) - }, "icon-download", "btn-default"); + }, __("From")); } }, }); diff --git a/erpnext/support/doctype/warranty_claim/warranty_claim.js b/erpnext/support/doctype/warranty_claim/warranty_claim.js index e33f9b29a3..991745ad12 100644 --- a/erpnext/support/doctype/warranty_claim/warranty_claim.js +++ b/erpnext/support/doctype/warranty_claim/warranty_claim.js @@ -15,8 +15,9 @@ erpnext.support.WarrantyClaim = frappe.ui.form.Controller.extend({ refresh: function() { if(!cur_frm.doc.__islocal && (cur_frm.doc.status=='Open' || cur_frm.doc.status == 'Work In Progress')) { - cur_frm.add_custom_button(__('Make Maintenance Visit'), - this.make_maintenance_visit, frappe.boot.doctype_icons["Maintenance Visit"], "btn-default") + cur_frm.add_custom_button(__('Maintenance Visit'), + this.make_maintenance_visit, __("Make")) + cur_frm.page.set_inner_btn_group_as_primary(__("Make")); } },