Merge pull request #4607 from saurabh6790/group_custom_buttons

[enhance] merge customize buttons under groups
This commit is contained in:
Rushabh Mehta 2016-01-15 11:15:23 +05:30
commit 66eaf7e1c3
33 changed files with 195 additions and 176 deletions

View File

@ -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')
}
}

View File

@ -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")
}
}

View File

@ -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 {

View File

@ -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,

View File

@ -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",

View File

@ -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() {

View File

@ -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"));
}
});

View File

@ -41,19 +41,18 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
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);
cur_frm.add_custom_button(__('Close'), this.close_purchase_order, __("Status"));
}
if(flt(doc.per_billed)==0) {
cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry);
}
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);
@ -61,25 +60,31 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
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");
}
this.make_purchase_invoice, __("Make"));
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");
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() {

View File

@ -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"));
}
},

View File

@ -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) {

View File

@ -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"));
}
});

View File

@ -78,30 +78,31 @@ $.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"));
}
}
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {

View File

@ -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"));
}
},

View File

@ -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"));
}
}

View File

@ -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"));
}
}

View File

@ -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"));
}
}

View File

@ -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"));
}
}

View File

@ -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);
}
}
}

View File

@ -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"));
}
}
}

View File

@ -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"));
}
}
});

View File

@ -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"));
}
}
},

View File

@ -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();

View File

@ -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

View File

@ -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);

View File

@ -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){

View File

@ -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"));
},

View File

@ -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.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)
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, __("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");

View File

@ -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) {

View File

@ -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);
});
}

View File

@ -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"));
}
}
});

View File

@ -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"));
}
},

View File

@ -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"));
}
},
});

View File

@ -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"));
}
},