diff --git a/public/js/complete_setup.js b/public/js/complete_setup.js index a93aae6ce1..d66d09a5ce 100644 --- a/public/js/complete_setup.js +++ b/public/js/complete_setup.js @@ -50,7 +50,7 @@ $.extend(erpnext.complete_setup, { }); if(user != 'Administrator'){ - $(d.appframe.$titlebar).find('.close').toggle(false); // Hide close image + d.$wrapper.find('.close').toggle(false); // Hide close image $('header').toggle(false); // hide toolbar } @@ -116,6 +116,7 @@ $.extend(erpnext.complete_setup, { var inp = d.fields_dict.company_name.input; inp.value = wn.control_panel.company_name; inp.disabled = true; + d.fields_dict.company_name.$input.trigger("change"); } // set first name, last name diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py index a85384b202..b029da3e2b 100644 --- a/setup/doctype/setup_control/setup_control.py +++ b/setup/doctype/setup_control/setup_control.py @@ -186,25 +186,21 @@ class DocType: from webnotes.model.doc import Document for company in companies_list: if company and company[0]: - edigest = Document('Email Digest') - edigest.name = "Default Weekly Digest - " + company[0] - edigest.company = company[0] - edigest.frequency = 'Weekly' - edigest.recipient_list = "\n".join(system_managers) - for f in ['new_leads', 'new_enquiries', 'new_quotations', - 'new_sales_orders', 'new_purchase_orders', - 'new_transactions', 'payables', 'payments', - 'expenses_booked', 'invoiced_amount', 'collections', - 'income', 'bank_balance', 'stock_below_rl', - 'income_year_to_date', 'enabled']: - edigest.fields[f] = 1 - exists = webnotes.conn.sql("""\ - SELECT name FROM `tabEmail Digest` - WHERE name = %s""", edigest.name) - if (exists and exists[0]) and exists[0][0]: + edigest = webnotes.bean({ + "doctype": "Email Digest", + "name": "Default Weekly Digest - " + company[0], + "company": company[0], + "frequency": "Weekly", + "recipient_list": "\n".join(system_managers) + }) + + if webnotes.conn.sql("""select name from `tabEmail Digest` where name=%s""", edigest.doc.name): continue - else: - edigest.save(1) + + for fieldname in edigest.meta.get_fieldnames({"fieldtype": "Check"}): + edigest.doc.fields[fieldname] = 1 + + edigest.insert() # Get Fiscal year Details # ------------------------