Conditionally toggle Naming Series. Fixes #1526
This commit is contained in:
parent
7f2d08b03f
commit
8bde7f9b3a
@ -111,7 +111,7 @@ cur_frm.script_manager.make(erpnext.accounts.JournalVoucher);
|
||||
|
||||
cur_frm.cscript.refresh = function(doc) {
|
||||
cur_frm.cscript.is_opening(doc)
|
||||
erpnext.hide_naming_series();
|
||||
erpnext.toggle_naming_series();
|
||||
cur_frm.cscript.voucher_type(doc);
|
||||
if(doc.docstatus==1) {
|
||||
cur_frm.appframe.add_button(__('View Ledger'), function() {
|
||||
|
@ -5,32 +5,37 @@
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
cur_frm.cscript.make_dashboard(doc);
|
||||
erpnext.hide_naming_series();
|
||||
|
||||
|
||||
if(frappe.defaults.get_default("supp_master_name")!="Naming Series") {
|
||||
cur_frm.toggle_display("naming_series", false);
|
||||
} else {
|
||||
erpnext.toggle_naming_series();
|
||||
}
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['address_html','contact_html']);
|
||||
hide_field(['address_html','contact_html']);
|
||||
}
|
||||
else{
|
||||
unhide_field(['address_html','contact_html']);
|
||||
// make lists
|
||||
cur_frm.cscript.make_address(doc,dt,dn);
|
||||
cur_frm.cscript.make_contact(doc,dt,dn);
|
||||
|
||||
|
||||
cur_frm.communication_view = new frappe.views.CommunicationList({
|
||||
list: frappe.get_list("Communication", {"supplier": doc.name}),
|
||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||
doc: doc
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_dashboard = function(doc) {
|
||||
cur_frm.dashboard.reset();
|
||||
if(doc.__islocal)
|
||||
if(doc.__islocal)
|
||||
return;
|
||||
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager"))
|
||||
cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')
|
||||
|
||||
|
||||
cur_frm.dashboard.add_doctype_badge("Supplier Quotation", "supplier");
|
||||
cur_frm.dashboard.add_doctype_badge("Purchase Order", "supplier");
|
||||
cur_frm.dashboard.add_doctype_badge("Purchase Receipt", "supplier");
|
||||
@ -45,10 +50,10 @@ cur_frm.cscript.make_dashboard = function(doc) {
|
||||
callback: function(r) {
|
||||
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
|
||||
cur_frm.dashboard.set_headline(
|
||||
__("Total Billing This Year: ") + "<b>"
|
||||
__("Total Billing This Year: ") + "<b>"
|
||||
+ format_currency(r.message.total_billing, erpnext.get_currency(cur_frm.doc.company))
|
||||
+ '</b> / <span class="text-muted">' + __("Unpaid") + ": <b>"
|
||||
+ format_currency(r.message.total_unpaid, erpnext.get_currency(cur_frm.doc.company))
|
||||
+ '</b> / <span class="text-muted">' + __("Unpaid") + ": <b>"
|
||||
+ format_currency(r.message.total_unpaid, erpnext.get_currency(cur_frm.doc.company))
|
||||
+ '</b></span>');
|
||||
}
|
||||
cur_frm.dashboard.set_badge_count(r.message);
|
||||
@ -97,4 +102,4 @@ cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{'buying': 1}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
|
||||
|
||||
refresh: function() {
|
||||
var me = this;
|
||||
erpnext.hide_naming_series();
|
||||
erpnext.toggle_naming_series();
|
||||
if(!this.frm.doc.__islocal) {
|
||||
cur_frm.add_custom_button(__('Make Salary Structure'), function() {
|
||||
me.make_salary_structure(this); });
|
||||
|
@ -12,7 +12,7 @@ $.extend(cur_frm.cscript, {
|
||||
|
||||
refresh: function(doc, dt, dn) {
|
||||
this.frm.dashboard.reset();
|
||||
erpnext.hide_naming_series();
|
||||
erpnext.toggle_naming_series();
|
||||
this.frm.set_intro("");
|
||||
cfn_set_fields(doc, dt, dn);
|
||||
|
||||
|
@ -45,7 +45,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||
|
||||
refresh: function() {
|
||||
this.frm.clear_custom_buttons();
|
||||
erpnext.hide_naming_series();
|
||||
erpnext.toggle_naming_series();
|
||||
erpnext.hide_company();
|
||||
this.show_item_wise_taxes();
|
||||
this.set_dynamic_labels();
|
||||
|
@ -12,7 +12,7 @@ $.extend(erpnext, {
|
||||
return frappe.boot.sysdefaults.currency;
|
||||
},
|
||||
|
||||
hide_naming_series: function() {
|
||||
toggle_naming_series: function() {
|
||||
if(cur_frm.fields_dict.naming_series) {
|
||||
cur_frm.toggle_display("naming_series", cur_frm.doc.__islocal?true:false);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
frappe.ui.form.on("Campaign", "refresh", function(frm) {
|
||||
erpnext.hide_naming_series();
|
||||
erpnext.toggle_naming_series();
|
||||
if(frm.doc.__islocal) {
|
||||
frm.toggle_display("naming_series", frappe.boot.sysdefaults.campaign_naming_by=="Naming Series");
|
||||
}
|
||||
|
@ -20,11 +20,16 @@ cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
cur_frm.cscript.setup_dashboard(doc);
|
||||
erpnext.hide_naming_series();
|
||||
|
||||
if(doc.__islocal){
|
||||
if(frappe.defaults.get_default("cust_master_name")!="Naming Series") {
|
||||
cur_frm.toggle_display("naming_series", false);
|
||||
} else {
|
||||
erpnext.toggle_naming_series();
|
||||
}
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['address_html','contact_html']);
|
||||
}else{
|
||||
}else{
|
||||
unhide_field(['address_html','contact_html']);
|
||||
// make lists
|
||||
cur_frm.cscript.make_address(doc, dt, dn);
|
||||
@ -39,17 +44,17 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
|
||||
cur_frm.cscript.setup_dashboard = function(doc) {
|
||||
cur_frm.dashboard.reset(doc);
|
||||
if(doc.__islocal)
|
||||
if(doc.__islocal)
|
||||
return;
|
||||
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager"))
|
||||
cur_frm.dashboard.set_headline('<span class="text-muted">'+ __('Loading...')+ '</span>')
|
||||
|
||||
|
||||
cur_frm.dashboard.add_doctype_badge("Opportunity", "customer");
|
||||
cur_frm.dashboard.add_doctype_badge("Quotation", "customer");
|
||||
cur_frm.dashboard.add_doctype_badge("Sales Order", "customer");
|
||||
cur_frm.dashboard.add_doctype_badge("Delivery Note", "customer");
|
||||
cur_frm.dashboard.add_doctype_badge("Sales Invoice", "customer");
|
||||
|
||||
|
||||
return frappe.call({
|
||||
type: "GET",
|
||||
method: "erpnext.selling.doctype.customer.customer.get_dashboard_info",
|
||||
@ -59,10 +64,10 @@ cur_frm.cscript.setup_dashboard = function(doc) {
|
||||
callback: function(r) {
|
||||
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
|
||||
cur_frm.dashboard.set_headline(
|
||||
__("Total Billing This Year: ") + "<b>"
|
||||
__("Total Billing This Year: ") + "<b>"
|
||||
+ format_currency(r.message.total_billing, erpnext.get_currency(cur_frm.doc.company))
|
||||
+ '</b> / <span class="text-muted">' + __("Unpaid") + ": <b>"
|
||||
+ format_currency(r.message.total_unpaid, erpnext.get_currency(cur_frm.doc.company))
|
||||
+ '</b> / <span class="text-muted">' + __("Unpaid") + ": <b>"
|
||||
+ format_currency(r.message.total_unpaid, erpnext.get_currency(cur_frm.doc.company))
|
||||
+ '</b></span>');
|
||||
}
|
||||
cur_frm.dashboard.set_badge_count(r.message);
|
||||
@ -122,4 +127,4 @@ cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {
|
||||
return{
|
||||
filters:{'selling': 1}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
|
||||
|
||||
refresh: function() {
|
||||
var doc = this.frm.doc;
|
||||
erpnext.hide_naming_series();
|
||||
erpnext.toggle_naming_series();
|
||||
this.frm.clear_custom_buttons();
|
||||
|
||||
this.frm.__is_customer = this.frm.__is_customer || this.frm.doc.__is_customer;
|
||||
|
@ -81,7 +81,7 @@ erpnext.selling.Opportunity = frappe.ui.form.Controller.extend({
|
||||
$.extend(cur_frm.cscript, new erpnext.selling.Opportunity({frm: cur_frm}));
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
erpnext.hide_naming_series();
|
||||
erpnext.toggle_naming_series();
|
||||
cur_frm.clear_custom_buttons();
|
||||
|
||||
if(doc.docstatus === 1 && doc.status!=="Lost") {
|
||||
|
@ -7,8 +7,14 @@ cur_frm.cscript.refresh = function(doc) {
|
||||
// make sensitive fields(has_serial_no, is_stock_item, valuation_method)
|
||||
// read only if any stock ledger entry exists
|
||||
|
||||
cur_frm.cscript.make_dashboard()
|
||||
erpnext.hide_naming_series();
|
||||
cur_frm.cscript.make_dashboard();
|
||||
|
||||
if (frappe.defaults.get_default("item_naming_by")!="Naming Series") {
|
||||
cur_frm.toggle_display("naming_series", false);
|
||||
} else {
|
||||
erpnext.toggle_naming_series();
|
||||
}
|
||||
|
||||
|
||||
if(!doc.__islocal && doc.show_in_website) {
|
||||
cur_frm.appframe.add_button("View In Website", function() {
|
||||
|
@ -61,7 +61,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
|
||||
refresh: function() {
|
||||
var me = this;
|
||||
erpnext.hide_naming_series();
|
||||
erpnext.toggle_naming_series();
|
||||
this.toggle_related_fields(this.frm.doc);
|
||||
this.toggle_enable_bom();
|
||||
this.show_stock_ledger();
|
||||
|
@ -13,7 +13,7 @@ cur_frm.cscript.onload = function(doc) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc) {
|
||||
erpnext.hide_naming_series();
|
||||
erpnext.toggle_naming_series();
|
||||
if(!doc.__islocal && !cint(doc.email_sent) && !doc.__unsaved
|
||||
&& inList(frappe.boot.user.can_write, doc.doctype)) {
|
||||
cur_frm.add_custom_button(__('Send'), function() {
|
||||
|
@ -17,7 +17,7 @@ $.extend(cur_frm.cscript, {
|
||||
},
|
||||
|
||||
refresh: function(doc) {
|
||||
erpnext.hide_naming_series();
|
||||
erpnext.toggle_naming_series();
|
||||
cur_frm.cscript.make_listing(doc);
|
||||
if(!doc.__islocal) {
|
||||
if(cur_frm.fields_dict.status.get_status()=="Write") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user