[ux] fixed primary action
This commit is contained in:
parent
d91cefb23d
commit
995185d02d
@ -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 = {
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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("");
|
||||
|
@ -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");
|
||||
|
||||
}
|
||||
|
||||
@ -112,7 +113,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
|
||||
entries_add: function(doc, cdt, cdn) {
|
||||
var row = frappe.get_doc(cdt, cdn);
|
||||
this.frm.script_manager.copy_from_first_row("entries", row,
|
||||
this.frm.script_manager.copy_from_first_row("entries", row,
|
||||
["expense_account", "cost_center", "project_name"]);
|
||||
},
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -16,10 +16,11 @@ 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'),
|
||||
cur_frm.add_custom_button(__('From Material Request'),
|
||||
function() {
|
||||
frappe.model.map_current_doc({
|
||||
method: "erpnext.stock.doctype.material_request.material_request.make_supplier_quotation",
|
||||
@ -32,10 +33,10 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
}, "icon-download", "btn-default");
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
make_purchase_order: function() {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
|
||||
@ -51,7 +52,7 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
||||
// no need to trigger updation of stock uom, as this field doesn't exist in supplier quotation
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query =
|
||||
cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query =
|
||||
function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:[
|
||||
@ -70,4 +71,4 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return {
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ frappe.pages['activity'].onload = function(wrapper) {
|
||||
single_column: true
|
||||
})
|
||||
wrapper.appframe.add_module_icon("Activity");
|
||||
|
||||
|
||||
var list = new frappe.ui.Listing({
|
||||
hide_refresh: true,
|
||||
appframe: wrapper.appframe,
|
||||
@ -21,12 +21,12 @@ frappe.pages['activity'].onload = function(wrapper) {
|
||||
list.run();
|
||||
|
||||
wrapper.appframe.set_title_right("Refresh", function() { list.run(); });
|
||||
|
||||
|
||||
// Build Report Button
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,23 +44,23 @@ erpnext.ActivityFeed = Class.extend({
|
||||
scrub_data: function(data) {
|
||||
data.by = frappe.user_info(data.owner).fullname;
|
||||
data.imgsrc = frappe.utils.get_file_link(frappe.user_info(data.owner).image);
|
||||
|
||||
|
||||
// feedtype
|
||||
if(!data.feed_type) {
|
||||
data.feed_type = __(data.doc_type);
|
||||
data.add_class = "label-info";
|
||||
data.onclick = repl('onclick="window.location.href=\'#!List/%(feed_type)s\';"', data)
|
||||
}
|
||||
|
||||
|
||||
// color for comment
|
||||
if(data.feed_type=='Comment') {
|
||||
data.add_class = "label-danger";
|
||||
}
|
||||
|
||||
|
||||
if(data.feed_type=='Assignment') {
|
||||
data.add_class = "label-warning";
|
||||
}
|
||||
|
||||
|
||||
// link
|
||||
if(data.doc_name && data.feed_type!='Login') {
|
||||
data.link = frappe.format(data.doc_name, {"fieldtype":"Link", "options":data.doc_type})
|
||||
@ -71,7 +71,7 @@ erpnext.ActivityFeed = Class.extend({
|
||||
add_date_separator: function(row, data) {
|
||||
var date = dateutil.str_to_obj(data.modified);
|
||||
var last = erpnext.last_feed_date;
|
||||
|
||||
|
||||
if((last && dateutil.obj_to_str(last) != dateutil.obj_to_str(date)) || (!last)) {
|
||||
var diff = dateutil.get_day_diff(dateutil.get_today(), dateutil.obj_to_str(date));
|
||||
if(diff < 1) {
|
||||
@ -85,4 +85,4 @@ erpnext.ActivityFeed = Class.extend({
|
||||
}
|
||||
erpnext.last_feed_date = date;
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -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"]);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -45,18 +45,18 @@ cur_frm.add_fetch('employee','employee_name','employee_name');
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn) {
|
||||
if(!doc.approval_status)
|
||||
cur_frm.set_value("approval_status", "Draft")
|
||||
|
||||
|
||||
if (doc.__islocal) {
|
||||
cur_frm.set_value("posting_date", dateutil.get_today());
|
||||
if(doc.amended_from)
|
||||
if(doc.amended_from)
|
||||
cur_frm.set_value("approval_status", "Draft");
|
||||
cur_frm.cscript.clear_sanctioned(doc);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query: "erpnext.controllers.queries.employee_query"
|
||||
}
|
||||
}
|
||||
}
|
||||
var exp_approver = doc.exp_approver;
|
||||
return cur_frm.call({
|
||||
@ -75,7 +75,7 @@ cur_frm.cscript.clear_sanctioned = function(doc) {
|
||||
}
|
||||
|
||||
doc.total_sanctioned_amount = '';
|
||||
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
|
||||
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
@ -84,15 +84,16 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
if(!doc.__islocal) {
|
||||
cur_frm.toggle_enable("exp_approver", (doc.owner==user && doc.approval_status=="Draft"));
|
||||
cur_frm.toggle_enable("approval_status", (doc.exp_approver==user && doc.docstatus==0));
|
||||
|
||||
if(!doc.__islocal && user!=doc.exp_approver)
|
||||
|
||||
if(!doc.__islocal && user!=doc.exp_approver)
|
||||
cur_frm.frm_head.appframe.set_title_right("");
|
||||
|
||||
|
||||
if(doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
|
||||
cur_frm.savesubmit();
|
||||
|
||||
|
||||
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"]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,7 +132,7 @@ cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
|
||||
}
|
||||
doc.total_sanctioned_amount += d.sanctioned_amount;
|
||||
});
|
||||
|
||||
|
||||
refresh_field("total_claimed_amount");
|
||||
refresh_field('total_sanctioned_amount');
|
||||
|
||||
@ -142,7 +143,7 @@ cur_frm.cscript.calculate_total_amount = function(doc,cdt,cdn){
|
||||
}
|
||||
cur_frm.cscript.claim_amount = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.calculate_total(doc,cdt,cdn);
|
||||
|
||||
|
||||
var child = locals[cdt][cdn];
|
||||
refresh_field("sanctioned_amount", child.name, child.parentfield);
|
||||
}
|
||||
@ -154,4 +155,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
if(cint(frappe.boot.notification_settings && frappe.boot.notification_settings.expense_claim)) {
|
||||
cur_frm.email_doc(frappe.boot.notification_settings.expense_claim_message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -5,13 +5,13 @@ cur_frm.cscript.tname = "Installation Note Item";
|
||||
cur_frm.cscript.fname = "installed_item_details";
|
||||
|
||||
|
||||
frappe.ui.form.on_change("Installation Note", "customer",
|
||||
frappe.ui.form.on_change("Installation Note", "customer",
|
||||
function(frm) { erpnext.utils.get_party_details(frm); });
|
||||
|
||||
frappe.ui.form.on_change("Installation Note", "customer_address",
|
||||
frappe.ui.form.on_change("Installation Note", "customer_address",
|
||||
function(frm) { erpnext.utils.get_address_display(frm); });
|
||||
|
||||
frappe.ui.form.on_change("Installation Note", "contact_person",
|
||||
frappe.ui.form.on_change("Installation Note", "contact_person",
|
||||
function(frm) { erpnext.utils.get_contact_details(frm); });
|
||||
|
||||
frappe.provide("erpnext.selling");
|
||||
@ -19,37 +19,37 @@ frappe.provide("erpnext.selling");
|
||||
erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({
|
||||
onload: function() {
|
||||
if(!this.frm.doc.status) set_multiple(dt,dn,{ status:'Draft'});
|
||||
if(this.frm.doc.__islocal) set_multiple(this.frm.doc.doctype, this.frm.doc.name,
|
||||
if(this.frm.doc.__islocal) set_multiple(this.frm.doc.doctype, this.frm.doc.name,
|
||||
{inst_date: get_today()});
|
||||
|
||||
|
||||
this.setup_queries();
|
||||
},
|
||||
|
||||
|
||||
setup_queries: function() {
|
||||
var me = this;
|
||||
|
||||
|
||||
this.frm.set_query("customer_address", function() {
|
||||
return {
|
||||
filters: {'customer': me.frm.doc.customer }
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.frm.set_query("contact_person", function() {
|
||||
return {
|
||||
filters: {'customer': me.frm.doc.customer }
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.frm.set_query("customer", function() {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.customer_query"
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
refresh: function() {
|
||||
if (this.frm.doc.docstatus===0) {
|
||||
cur_frm.add_custom_button(__('From Delivery Note'),
|
||||
cur_frm.add_custom_button(__('From Delivery Note'),
|
||||
function() {
|
||||
frappe.model.map_current_doc({
|
||||
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_installation_note",
|
||||
@ -62,10 +62,10 @@ erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
}
|
||||
}, "icon-download", "btn-default"
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
$.extend(cur_frm.cscript, new erpnext.selling.InstallationNote({frm: cur_frm}));
|
||||
$.extend(cur_frm.cscript, new erpnext.selling.InstallationNote({frm: cur_frm}));
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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: [
|
||||
|
@ -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",
|
||||
|
@ -35,12 +35,12 @@ class Company(Document):
|
||||
self.default_currency != self.previous_default_currency and \
|
||||
self.check_if_transactions_exist():
|
||||
frappe.throw(_("Cannot change company's default currency, because there are existing transactions. Transactions must be cancelled to change the default currency."))
|
||||
|
||||
|
||||
self.validate_default_accounts()
|
||||
|
||||
|
||||
def validate_default_accounts(self):
|
||||
for field in ["default_bank_account", "default_cash_account", "receivables_group", "payables_group",
|
||||
"default_expense_account", "default_income_account", "stock_received_but_not_billed",
|
||||
for field in ["default_bank_account", "default_cash_account", "receivables_group", "payables_group",
|
||||
"default_expense_account", "default_income_account", "stock_received_but_not_billed",
|
||||
"stock_adjustment_account", "expenses_included_in_valuation"]:
|
||||
if self.get(field):
|
||||
for_company = frappe.db.get_value("Account", self.get(field), "company")
|
||||
@ -127,7 +127,7 @@ class Company(Document):
|
||||
_set_default_account("expenses_included_in_valuation", "Expenses Included In Valuation")
|
||||
|
||||
if not self.default_income_account:
|
||||
self.db_set("default_income_account", frappe.db.get_value("Account",
|
||||
self.db_set("default_income_account", frappe.db.get_value("Account",
|
||||
{"account_name": _("Sales"), "company": self.name}))
|
||||
|
||||
def create_default_cost_center(self):
|
||||
@ -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):
|
||||
|
@ -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) {
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -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')
|
||||
|
@ -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");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -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");
|
||||
});
|
||||
|
@ -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() {
|
||||
|
@ -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");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -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")
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -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"]);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -3,18 +3,18 @@
|
||||
|
||||
frappe.provide("erpnext.support");
|
||||
|
||||
frappe.ui.form.on_change("Maintenance Visit", "customer", function(frm) {
|
||||
frappe.ui.form.on_change("Maintenance Visit", "customer", function(frm) {
|
||||
erpnext.utils.get_party_details(frm) });
|
||||
frappe.ui.form.on_change("Maintenance Visit", "customer_address",
|
||||
frappe.ui.form.on_change("Maintenance Visit", "customer_address",
|
||||
erpnext.utils.get_address_display);
|
||||
frappe.ui.form.on_change("Maintenance Visit", "contact_person",
|
||||
erpnext.utils.get_contact_details);
|
||||
frappe.ui.form.on_change("Maintenance Visit", "contact_person",
|
||||
erpnext.utils.get_contact_details);
|
||||
|
||||
// TODO commonify this code
|
||||
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(__('From Maintenance Schedule'),
|
||||
function() {
|
||||
frappe.model.map_current_doc({
|
||||
method: "erpnext.support.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit",
|
||||
@ -25,8 +25,8 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
cur_frm.add_custom_button(__('From Customer Issue'),
|
||||
}, "icon-download", "btn-default");
|
||||
cur_frm.add_custom_button(__('From Customer Issue'),
|
||||
function() {
|
||||
frappe.model.map_current_doc({
|
||||
method: "erpnext.support.doctype.customer_issue.customer_issue.make_maintenance_visit",
|
||||
@ -37,8 +37,8 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
cur_frm.add_custom_button(__('From Sales Order'),
|
||||
}, "icon-download", "btn-default");
|
||||
cur_frm.add_custom_button(__('From Sales Order'),
|
||||
function() {
|
||||
frappe.model.map_current_doc({
|
||||
method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit",
|
||||
@ -50,7 +50,7 @@ erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({
|
||||
company: cur_frm.doc.company
|
||||
}
|
||||
})
|
||||
});
|
||||
}, "icon-download", "btn-default");
|
||||
}
|
||||
},
|
||||
});
|
||||
@ -91,4 +91,4 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return {query: "erpnext.controllers.queries.customer_query" }
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -15,27 +15,29 @@ $.extend(cur_frm.cscript, {
|
||||
<span class="help">'+__("Integrate incoming support emails to Support Ticket")+'</span></p>';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
refresh: function(doc) {
|
||||
erpnext.toggle_naming_series();
|
||||
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);
|
||||
cur_frm.toggle_display("description", false);
|
||||
}
|
||||
refresh_field('status');
|
||||
},
|
||||
|
||||
|
||||
make_listing: function(doc) {
|
||||
var wrapper = cur_frm.fields_dict['thread_html'].wrapper;
|
||||
|
||||
|
||||
var comm_list = frappe.get_list("Communication", {"parent": doc.name, "parenttype":"Support Ticket"})
|
||||
|
||||
|
||||
if(!comm_list.length) {
|
||||
comm_list.push({
|
||||
"sender": doc.raised_by,
|
||||
@ -43,7 +45,7 @@ $.extend(cur_frm.cscript, {
|
||||
"subject": doc.subject,
|
||||
"content": doc.description});
|
||||
}
|
||||
|
||||
|
||||
cur_frm.communication_view = new frappe.views.CommunicationList({
|
||||
list: comm_list,
|
||||
parent: wrapper,
|
||||
@ -52,11 +54,11 @@ $.extend(cur_frm.cscript, {
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
|
||||
'Close Ticket': function() {
|
||||
cur_frm.cscript.set_status("Closed");
|
||||
},
|
||||
|
||||
|
||||
'Re-Open Ticket': function() {
|
||||
cur_frm.cscript.set_status("Open");
|
||||
},
|
||||
@ -72,8 +74,8 @@ $.extend(cur_frm.cscript, {
|
||||
if(!r.exc) cur_frm.reload_doc();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user