[ux] fixed primary action

This commit is contained in:
Rushabh Mehta 2014-08-07 15:24:26 +05:30 committed by Anand Doshi
parent d91cefb23d
commit 995185d02d
34 changed files with 206 additions and 157 deletions

View File

@ -65,10 +65,10 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) {
if (cstr(doc.group_or_ledger) == 'Group') {
cur_frm.add_custom_button(__('Convert to Ledger'),
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet')
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet', 'btn-default');
} else if (cstr(doc.group_or_ledger) == 'Ledger') {
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')
cur_frm.appframe.add_button(__('View Ledger'), function() {
frappe.route_options = {

View File

@ -64,10 +64,12 @@ cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) {
cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
if (cstr(doc.group_or_ledger) == 'Group') {
cur_frm.add_custom_button(__('Convert to Ledger'),
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet')
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet',
"btn-default")
} else if (cstr(doc.group_or_ledger) == 'Ledger') {
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,8 @@ $.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.cscript.set_as_default);
this.frm.add_custom_button('<i class="icon-star"></i> ' + __("Set as Default"),
this.frm.cscript.set_as_default);
this.frm.set_intro(__("To set this Fiscal Year as Default, click on 'Set as Default'"));
} else {
this.frm.set_intro("");

View File

@ -27,7 +27,8 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
// Show / Hide button
if(doc.docstatus==1 && doc.outstanding_amount > 0)
this.frm.add_custom_button(__('Make Payment Entry'), this.make_bank_voucher);
this.frm.add_custom_button(__('Make Payment Entry'), this.make_bank_voucher,
frappe.boot.doctype_icons["Journal Voucher"]);
if(doc.docstatus==1) {
cur_frm.appframe.add_button(__('View Ledger'), function() {
@ -56,7 +57,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
company: cur_frm.doc.company
}
})
});
}, "icon-download", "btn-default");
cur_frm.add_custom_button(__('From Purchase Receipt'),
function() {
@ -69,7 +70,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
company: cur_frm.doc.company
}
})
});
}, "icon-download", "btn-default");
}

View File

@ -74,11 +74,12 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
});
if(!from_delivery_note)
cur_frm.appframe.add_primary_action(__('Make Delivery'), cur_frm.cscript['Make Delivery Note'])
cur_frm.appframe.add_primary_action(__('Make Delivery'), cur_frm.cscript['Make Delivery Note'], "icon-truck")
}
if(doc.outstanding_amount!=0)
cur_frm.appframe.add_primary_action(__('Make Payment Entry'), cur_frm.cscript.make_bank_voucher);
if(doc.outstanding_amount!=0) {
cur_frm.appframe.add_primary_action(__('Make Payment Entry'), cur_frm.cscript.make_bank_voucher, "icon-money");
}
}
// Show buttons only when pos view is active

View File

@ -22,14 +22,18 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
cur_frm.dashboard.add_progress(cint(doc.per_billed) + __("% Billed"),
doc.per_billed);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
if(flt(doc.per_received, 2) < 100)
cur_frm.add_custom_button(__('Make Purchase Receipt'), this.make_purchase_receipt);
cur_frm.add_custom_button(__('Make Purchase Receipt'),
this.make_purchase_receipt, frappe.boot.doctype_icons["Purchase Receipt"]);
if(flt(doc.per_billed, 2) < 100)
cur_frm.add_custom_button(__('Make Invoice'), this.make_purchase_invoice);
cur_frm.add_custom_button(__('Make Invoice'), this.make_purchase_invoice,
frappe.boot.doctype_icons["Purchase Invoice"]);
if(flt(doc.per_billed, 2) < 100 || doc.per_received < 100)
cur_frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Purchase Order'], "icon-exclamation");
cur_frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Purchase Order'],
"icon-exclamation", "btn-default");
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms, "icon-mobile-phone", true);
} else if(doc.docstatus===0) {
cur_frm.cscript.add_from_mappers();
}
@ -67,7 +71,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
company: cur_frm.doc.company
}
})
}
}, "icon-download", "btn-default"
);
cur_frm.add_custom_button(__('From Supplier Quotation'),
@ -81,7 +85,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
company: cur_frm.doc.company
}
})
}
}, "icon-download", "btn-default"
);
cur_frm.add_custom_button(__('For Supplier'),
@ -93,7 +97,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
docstatus: ["!=", 2],
}
})
}
}, "icon-download", "btn-default"
);
},

View File

@ -16,7 +16,8 @@ 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);
cur_frm.add_custom_button(__("Make Purchase Order"), this.make_purchase_order,
frappe.boot.doctype_icons["Journal Voucher"]);
}
else if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('From Material Request'),
@ -32,7 +33,7 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
company: cur_frm.doc.company
}
})
});
}, "icon-download", "btn-default");
}
},

View File

@ -26,7 +26,7 @@ frappe.pages['activity'].onload = function(wrapper) {
if(frappe.boot.user.can_get_report.indexOf("Feed")!=-1) {
wrapper.appframe.add_primary_action(__('Build Report'), function() {
frappe.set_route('Report', "Feed");
}, 'icon-th')
}, 'icon-th', true);
}
}

View File

@ -21,7 +21,7 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
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); });
me.make_salary_structure(this); }, frappe.boot.doctype_icons["Salary Structure"]);
}
},

View File

@ -92,7 +92,8 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
cur_frm.savesubmit();
if(doc.docstatus==1 && frappe.model.can_create("Journal Voucher"))
cur_frm.add_custom_button(__("Make Bank Voucher"), cur_frm.cscript.make_bank_voucher);
cur_frm.add_custom_button(__("Make Bank Voucher"),
cur_frm.cscript.make_bank_voucher, frappe.boot.doctype_icons["Journal Voucher"]);
}
}

View File

@ -12,7 +12,8 @@ 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']);
cur_frm.add_custom_button(__('Make Salary Slip'),
cur_frm.cscript['Make Salary Slip'], frappe.boot.doctype_icons["Salary Slip"]);
}
}

View File

@ -7,7 +7,8 @@ cur_frm.cscript.refresh = function(doc,dt,dn){
cur_frm.toggle_enable("item", doc.__islocal);
if (!doc.__islocal && doc.docstatus<2) {
cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost);
cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost,
"icon-money", "btn-default");
}
cur_frm.cscript.with_operations(doc);

View File

@ -58,14 +58,20 @@ $.extend(cur_frm.cscript, {
var cfn_set_fields = function(doc, dt, dn) {
if (doc.docstatus == 1) {
if (doc.status != 'Stopped' && doc.status != 'Completed')
cur_frm.add_custom_button(__('Stop!'), cur_frm.cscript['Stop Production Order'], "icon-exclamation");
else if (doc.status == 'Stopped')
cur_frm.add_custom_button(__('Unstop'), cur_frm.cscript['Unstop Production Order'], "icon-check");
if (doc.status == 'Submitted' || doc.status == 'Material Transferred' || doc.status == 'In Process'){
cur_frm.add_custom_button(__('Transfer Raw Materials'), cur_frm.cscript['Transfer Raw Materials']);
cur_frm.add_custom_button(__('Update Finished Goods'), cur_frm.cscript['Update Finished Goods']);
cur_frm.add_custom_button(__('Transfer Raw Materials'),
cur_frm.cscript['Transfer Raw Materials'], frappe.boot.doctype_icons["Stock Entry"]);
cur_frm.add_custom_button(__('Update Finished Goods'),
cur_frm.cscript['Update Finished Goods'], frappe.boot.doctype_icons["Stock Entry"]);
}
if (doc.status != 'Stopped' && doc.status != 'Completed') {
cur_frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Production Order'],
"icon-exclamation", "btn-default");
} else if (doc.status == 'Stopped') {
cur_frm.add_custom_button(__('Unstop'), cur_frm.cscript['Unstop Production Order'],
"icon-check", "btn-default");
}
}
}

View File

@ -57,23 +57,23 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
this.set_dynamic_labels();
// Show POS button only if it is enabled from features setup
if(cint(sys_defaults.fs_pos_view)===1 && this.frm.doctype!="Material Request")
if(cint(sys_defaults.fs_pos_view)===1 && this.frm.doctype!="Material Request" && this.frm.doc.docstatus===0)
this.make_pos_btn();
},
make_pos_btn: function() {
if(!this.pos_active) {
var btn_label = __("POS View"),
icon = "icon-desktop";
icon = "icon-th";
} else {
var btn_label = __(this.frm.doctype) + __(" View"),
var btn_label = __("Form View"),
icon = "icon-file-text";
}
var me = this;
this.$pos_btn = this.frm.appframe.add_button(btn_label, function() {
this.$pos_btn = this.frm.appframe.add_primary_action(btn_label, function() {
me.toggle_pos();
}, icon);
}, icon, "btn-default");
},
toggle_pos: function(show) {

View File

@ -62,7 +62,7 @@ erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({
company: cur_frm.doc.company
}
})
}
}, "icon-download", "btn-default"
);
}
},

View File

@ -32,8 +32,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);
this.frm.add_custom_button(__("Create Opportunity"), this.create_opportunity);
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.appframe.add_button(__("Send SMS"), this.frm.cscript.send_sms, "icon-mobile-phone");
}

View File

@ -82,11 +82,15 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
erpnext.toggle_naming_series();
if(doc.docstatus === 1 && doc.status!=="Lost") {
cur_frm.add_custom_button(__('Create Quotation'), cur_frm.cscript.create_quotation);
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']);
cur_frm.add_custom_button(__('Opportunity Lost'),
cur_frm.cscript['Declare Opportunity Lost'], "icon-remove", "btn-default");
cur_frm.add_custom_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", true);
}
}

View File

@ -27,10 +27,10 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
if(doc.docstatus == 1 && doc.status!=='Lost') {
cur_frm.add_custom_button(__('Make Sales Order'),
cur_frm.cscript['Make Sales Order']);
cur_frm.cscript['Make Sales Order'], frappe.boot.doctype_icons["Sales Order"]);
if(doc.status!=="Ordered") {
cur_frm.add_custom_button(__('Set as Lost'),
cur_frm.cscript['Declare Order Lost'], "icon-exclamation");
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");
}
@ -50,7 +50,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
company: cur_frm.doc.company
}
})
});
}, "icon-download", "btn-default");
}
if (!doc.__islocal) {

View File

@ -25,30 +25,36 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
cur_frm.dashboard.add_progress(cint(doc.per_billed) + __("% Billed"),
doc.per_billed);
cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
// delivery note
if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1)
cur_frm.add_custom_button(__('Make Delivery'), this.make_delivery_note);
// maintenance
if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)===-1) {
cur_frm.add_custom_button(__('Make Maint. Visit'), this.make_maintenance_visit);
cur_frm.add_custom_button(__('Make Maint. Schedule'),
this.make_maintenance_schedule);
}
cur_frm.add_custom_button(__('Make Delivery'), this.make_delivery_note, "icon-truck");
// indent
if(!doc.order_type || ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1)
cur_frm.add_custom_button(__('Make ') + __('Material Request'),
this.make_material_request);
this.make_material_request, "icon-ticket");
// sales invoice
if(flt(doc.per_billed, 2) < 100)
cur_frm.add_custom_button(__('Make Invoice'), this.make_sales_invoice);
if(flt(doc.per_billed, 2) < 100) {
cur_frm.add_custom_button(__('Make Invoice'), this.make_sales_invoice,
frappe.boot.doctype_icons["Sales Invoice"]);
}
// stop
if(flt(doc.per_delivered, 2) < 100 || doc.per_billed < 100)
cur_frm.add_custom_button(__('Stop!'), cur_frm.cscript['Stop Sales Order'],"icon-exclamation");
cur_frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Sales Order'],
"icon-exclamation", "btn-default")
// maintenance
if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)===-1) {
cur_frm.add_custom_button(__('Make Maint. Visit'),
this.make_maintenance_visit, null, "btn-default");
cur_frm.add_custom_button(__('Make Maint. Schedule'),
this.make_maintenance_schedule, null, "btn-default");
}
cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone", true);
} else {
// un-stop
cur_frm.dashboard.set_headline_alert(__("Stopped"), "alert-danger", "icon-stop");
@ -70,7 +76,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
company: cur_frm.doc.company
}
})
});
}, "icon-download", "btn-default");
}
this.order_type(doc);

View File

@ -4,8 +4,6 @@
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
if(doc.abbr && !doc.__islocal) {
cur_frm.set_df_property("abbr", "read_only", 1);
if(in_list(user_roles, "System Manager"))
cur_frm.add_custom_button("Replace Abbreviation", cur_frm.cscript.replace_abbr)
}
if(!doc.__islocal) {
@ -14,7 +12,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}
}
cur_frm.cscript.replace_abbr = function() {
cur_frm.cscript.change_abbr = function() {
var dialog = new frappe.ui.Dialog({
title: "Replace Abbr",
fields: [

View File

@ -39,6 +39,13 @@
"read_only": 0,
"reqd": 1
},
{
"depends_on": "eval:!doc.__islocal && in_list(user_roles, \"System Manager\")",
"fieldname": "change_abbr",
"fieldtype": "Button",
"label": "Change Abbreviation",
"permlevel": 0
},
{
"fieldname": "cb0",
"fieldtype": "Column Break",
@ -349,7 +356,7 @@
],
"icon": "icon-building",
"idx": 1,
"modified": "2014-07-17 19:30:24.487672",
"modified": "2014-08-07 05:20:47.711849",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",

View File

@ -277,6 +277,8 @@ class Company(Document):
@frappe.whitelist()
def replace_abbr(company, old, new):
frappe.only_for("System Manager")
frappe.db.set_value("Company", company, "abbr", new)
def _rename_record(dt):

View File

@ -28,7 +28,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
} else {
msgprint(save_msg);
}
}, 1);
}, "icon-eye-open", "btn-default");
cur_frm.add_custom_button(__('Send Now'), function() {
doc = locals[dt][dn];
if(doc.__unsaved != 1) {
@ -44,7 +44,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
} else {
msgprint(save_msg);
}
}, 1);
}, "icon-envelope", "btn-default");
}
cur_frm.cscript.addremove_recipients = function(doc, dt, dn) {

View File

@ -38,7 +38,8 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
}
if(doc.docstatus==0 && !doc.__islocal) {
cur_frm.add_custom_button(__('Make Packing Slip'), cur_frm.cscript['Make Packing Slip']);
cur_frm.add_custom_button(__('Make Packing Slip'),
cur_frm.cscript['Make Packing Slip'], frappe.boot.doctype_icons["Packing Slip"], "btn-default");
}
erpnext.stock.delivery_note.set_print_hide(doc, dt, dn);
@ -62,7 +63,7 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
company: cur_frm.doc.company
}
})
});
}, "icon-download", "btn-default");
}
},

View File

@ -30,26 +30,30 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
}
if(doc.docstatus==0) {
cur_frm.add_custom_button(__("Get Items from BOM"), cur_frm.cscript.get_items_from_bom, "icon-sitemap");
cur_frm.add_custom_button(__("Get Items from BOM"),
cur_frm.cscript.get_items_from_bom, "icon-sitemap", "btn-default");
}
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);
this.make_supplier_quotation,
frappe.boot.doctype_icons["Supplier Quotation"]);
if(doc.material_request_type === "Transfer" && doc.status === "Submitted")
cur_frm.add_custom_button(__("Transfer Material"), this.make_stock_entry);
cur_frm.add_custom_button(__("Transfer Material"), this.make_stock_entry,
frappe.boot.doctype_icons["Stock Entry"]);
if(flt(doc.per_ordered, 2) < 100) {
if(doc.material_request_type === "Purchase")
cur_frm.add_custom_button(__('Make Purchase Order'),
this.make_purchase_order);
this.make_purchase_order, frappe.boot.doctype_icons["Purchase Order"]);
cur_frm.add_custom_button(__('Stop Material Request'),
cur_frm.cscript['Stop Material Request'], "icon-exclamation");
cur_frm.add_custom_button(__('Stop'),
cur_frm.cscript['Stop Material Request'], "icon-exclamation", "btn-default");
}
cur_frm.add_custom_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", true);
}
@ -66,7 +70,7 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
company: cur_frm.doc.company
}
})
});
}, "icon-download", "btn-default");
}
if(doc.docstatus == 1 && doc.status == 'Stopped')

View File

@ -16,14 +16,15 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
if(this.frm.doc.docstatus == 1) {
if(this.frm.doc.__onload && !this.frm.doc.__onload.billing_complete) {
cur_frm.add_custom_button(__('Make Purchase Invoice'), this.make_purchase_invoice);
cur_frm.add_custom_button(__('Make Purchase Invoice'), this.make_purchase_invoice,
frappe.boot.doctype_icons["Purchase Invoice"]);
}
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms, "icon-mobile-phone", true);
this.show_stock_ledger();
this.show_general_ledger();
} else {
cur_frm.add_custom_button(__(__('From Purchase Order')),
cur_frm.add_custom_button(__('From Purchase Order'),
function() {
frappe.model.map_current_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
@ -36,7 +37,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
company: cur_frm.doc.company
}
})
});
}, "icon-download", "btn-default");
}
},

View File

@ -22,5 +22,5 @@ frappe.ui.form.on("Serial No", "refresh", function(frm) {
cur_frm.add_custom_button(__('Set Status as Available'), function() {
cur_frm.set_value("status", "Available");
cur_frm.save();
});
}, "icon-ok", "btn-default");
});

View File

@ -71,10 +71,12 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
if(this.frm.doc.docstatus === 1 &&
frappe.boot.user.can_create.indexOf("Journal Voucher")!==-1) {
if(this.frm.doc.purpose === "Sales Return") {
this.frm.add_custom_button(__("Make Credit Note"), function() { me.make_return_jv(); });
this.frm.add_custom_button(__("Make Credit Note"),
function() { me.make_return_jv(); }, frappe.boot.doctype_icons["Journal Voucher"]);
this.add_excise_button();
} else if(this.frm.doc.purpose === "Purchase Return") {
this.frm.add_custom_button(__("Make Debit Note"), function() { me.make_return_jv(); });
this.frm.add_custom_button(__("Make Debit Note"),
function() { me.make_return_jv(); }, frappe.boot.doctype_icons["Journal Voucher"]);
this.add_excise_button();
}
}
@ -199,7 +201,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
excise = locals['Journal Voucher'][excise];
excise.voucher_type = 'Excise Voucher';
loaddoc('Journal Voucher', excise.name);
});
}, frappe.boot.doctype_icons["Journal Voucher"], "btn-default");
},
make_return_jv: function() {

View File

@ -124,7 +124,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
this.title = __("Stock Reconcilation Data");
frappe.tools.downloadify(JSON.parse(me.frm.doc.reconciliation_json), null, this);
return false;
}, "icon-download");
}, "icon-download", "btn-default");
}
},

View File

@ -13,7 +13,8 @@ frappe.ui.form.on_change("Customer Issue", "contact_person",
erpnext.support.CustomerIssue = frappe.ui.form.Controller.extend({
refresh: function() {
if((cur_frm.doc.status=='Open' || cur_frm.doc.status == 'Work In Progress')) {
cur_frm.add_custom_button(__('Make Maintenance Visit'), this.make_maintenance_visit)
cur_frm.add_custom_button(__('Make Maintenance Visit'),
this.make_maintenance_visit, frappe.boot.doctype_icons["Maintenance Visit"], "btn-default")
}
},

View File

@ -28,7 +28,7 @@ erpnext.support.MaintenanceSchedule = frappe.ui.form.Controller.extend({
company: me.frm.doc.company
}
});
});
}, "icon-download", "btn-default");
} 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"]);
}
},

View File

@ -25,7 +25,7 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({
company: cur_frm.doc.company
}
})
});
}, "icon-download", "btn-default");
cur_frm.add_custom_button(__('From Customer Issue'),
function() {
frappe.model.map_current_doc({
@ -37,7 +37,7 @@ 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'),
function() {
frappe.model.map_current_doc({
@ -50,7 +50,7 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({
company: cur_frm.doc.company
}
})
});
}, "icon-download", "btn-default");
}
},
});

View File

@ -20,7 +20,7 @@ cur_frm.cscript.refresh = function(doc) {
return $c_obj(doc, 'send_emails', '', function(r) {
cur_frm.refresh();
});
})
}, "icon-play", "btn-success");
}
cur_frm.cscript.setup_dashboard();

View File

@ -21,8 +21,10 @@ $.extend(cur_frm.cscript, {
cur_frm.cscript.make_listing(doc);
if(!doc.__islocal) {
if(cur_frm.fields_dict.status.get_status()=="Write") {
if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']);
if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']);
if(doc.status!='Closed') cur_frm.add_custom_button('Close',
cur_frm.cscript['Close Ticket'], "icon-ok", "btn-success");
if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket',
cur_frm.cscript['Re-Open Ticket'], null, "btn-default");
}
cur_frm.toggle_enable(["subject", "raised_by"], false);