Fixes in Setup Wizard and Attachments
This commit is contained in:
parent
3f51705ba4
commit
07339fc69e
@ -39,7 +39,7 @@ erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
|
|||||||
method: 'erpnext.hr.doctype.upload_attendance.upload_attendance.upload'
|
method: 'erpnext.hr.doctype.upload_attendance.upload_attendance.upload'
|
||||||
},
|
},
|
||||||
sample_url: "e.g. http://example.com/somefile.csv",
|
sample_url: "e.g. http://example.com/somefile.csv",
|
||||||
callback: function(fid, filename, r) {
|
callback: function(attachment, r) {
|
||||||
var $log_wrapper = $(cur_frm.fields_dict.import_log.wrapper).empty();
|
var $log_wrapper = $(cur_frm.fields_dict.import_log.wrapper).empty();
|
||||||
|
|
||||||
if(!r.messages) r.messages = [];
|
if(!r.messages) r.messages = [];
|
||||||
|
@ -106,6 +106,13 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
|||||||
slide.form.fields_dict.first_name.set_input(frappe.boot.user.first_name);
|
slide.form.fields_dict.first_name.set_input(frappe.boot.user.first_name);
|
||||||
slide.form.fields_dict.last_name.set_input(frappe.boot.user.last_name);
|
slide.form.fields_dict.last_name.set_input(frappe.boot.user.last_name);
|
||||||
|
|
||||||
|
var user_image = frappe.get_cookie("user_image");
|
||||||
|
if(user_image) {
|
||||||
|
var $attach_user = slide.form.fields_dict.attach_user.$wrapper;
|
||||||
|
$attach_user.find(".missing-image").toggle(false);
|
||||||
|
$attach_user.find("img").attr("src", user_image).toggle(true);
|
||||||
|
}
|
||||||
|
|
||||||
delete slide.form.fields_dict.email;
|
delete slide.form.fields_dict.email;
|
||||||
delete slide.form.fields_dict.password;
|
delete slide.form.fields_dict.password;
|
||||||
}
|
}
|
||||||
@ -226,7 +233,7 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
|||||||
slide.fields = slide.fields.concat([
|
slide.fields = slide.fields.concat([
|
||||||
{fieldtype:"Data", fieldname:"tax_"+ i, label:__("Tax") + " " + i, placeholder:__("e.g. VAT")},
|
{fieldtype:"Data", fieldname:"tax_"+ i, label:__("Tax") + " " + i, placeholder:__("e.g. VAT")},
|
||||||
{fieldtype:"Column Break"},
|
{fieldtype:"Column Break"},
|
||||||
{fieldtype:"Data", fieldname:"tax_rate_i", label:__("Rate (%)"), placeholder:__("e.g. 5")},
|
{fieldtype:"Data", fieldname:"tax_rate_" + i, label:__("Rate (%)"), placeholder:__("e.g. 5")},
|
||||||
{fieldtype:"Section Break"},
|
{fieldtype:"Section Break"},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe, json
|
import frappe, json
|
||||||
|
|
||||||
from frappe.utils import cstr, getdate
|
from frappe.utils import cstr, flt, getdate
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils.file_manager import save_file
|
from frappe.utils.file_manager import save_file
|
||||||
from frappe.translate import set_default_language, get_dict, get_lang_dict
|
from frappe.translate import set_default_language, get_dict, get_lang_dict
|
||||||
@ -15,8 +15,8 @@ import install_fixtures
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def setup_account(args=None):
|
def setup_account(args=None):
|
||||||
# if frappe.db.sql("select name from tabCompany"):
|
if frappe.db.sql("select name from tabCompany"):
|
||||||
# frappe.throw(_("Setup Already Complete!!"))
|
frappe.throw(_("Setup Already Complete!!"))
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
args = frappe.local.form_dict
|
args = frappe.local.form_dict
|
||||||
@ -67,7 +67,7 @@ def setup_account(args=None):
|
|||||||
|
|
||||||
frappe.db.set_default('desktop:home_page', 'desktop')
|
frappe.db.set_default('desktop:home_page', 'desktop')
|
||||||
|
|
||||||
website_maker(args.company_name, args.company_tagline, args.email)
|
website_maker(args.company_name, args.company_tagline, args.name)
|
||||||
|
|
||||||
frappe.clear_cache()
|
frappe.clear_cache()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
@ -259,6 +259,9 @@ def get_fy_details(fy_start_date, fy_end_date):
|
|||||||
def create_taxes(args):
|
def create_taxes(args):
|
||||||
for i in xrange(1,6):
|
for i in xrange(1,6):
|
||||||
if args.get("tax_" + str(i)):
|
if args.get("tax_" + str(i)):
|
||||||
|
# replace % in case someone also enters the % symbol
|
||||||
|
tax_rate = (args.get("tax_rate_" + str(i)) or "").replace("%", "")
|
||||||
|
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
"doctype":"Account",
|
"doctype":"Account",
|
||||||
"company": args.get("company_name"),
|
"company": args.get("company_name"),
|
||||||
@ -267,7 +270,7 @@ def create_taxes(args):
|
|||||||
"group_or_ledger": "Ledger",
|
"group_or_ledger": "Ledger",
|
||||||
"report_type": "Balance Sheet",
|
"report_type": "Balance Sheet",
|
||||||
"account_type": "Tax",
|
"account_type": "Tax",
|
||||||
"tax_rate": args.get("tax_rate_" + str(i))
|
"tax_rate": flt(tax_rate) if tax_rate else None
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
def create_items(args):
|
def create_items(args):
|
||||||
@ -290,7 +293,7 @@ def create_items(args):
|
|||||||
|
|
||||||
if args.get("item_img_" + str(i)):
|
if args.get("item_img_" + str(i)):
|
||||||
filename, filetype, content = args.get("item_img_" + str(i)).split(",")
|
filename, filetype, content = args.get("item_img_" + str(i)).split(",")
|
||||||
fileurl = save_file(filename, content, "Item", item, decode=True).file_name
|
fileurl = save_file(filename, content, "Item", item, decode=True).file_url
|
||||||
frappe.db.set_value("Item", item, "image", fileurl)
|
frappe.db.set_value("Item", item, "image", fileurl)
|
||||||
|
|
||||||
for i in xrange(1,6):
|
for i in xrange(1,6):
|
||||||
@ -311,7 +314,7 @@ def create_items(args):
|
|||||||
|
|
||||||
if args.get("item_img_" + str(i)):
|
if args.get("item_img_" + str(i)):
|
||||||
filename, filetype, content = args.get("item_img_" + str(i)).split(",")
|
filename, filetype, content = args.get("item_img_" + str(i)).split(",")
|
||||||
fileurl = save_file(filename, content, "Item", item, decode=True).file_name
|
fileurl = save_file(filename, content, "Item", item, decode=True).file_url
|
||||||
frappe.db.set_value("Item", item, "image", fileurl)
|
frappe.db.set_value("Item", item, "image", fileurl)
|
||||||
|
|
||||||
|
|
||||||
|
@ -204,15 +204,6 @@ class Item(WebsiteGenerator):
|
|||||||
def get_tax_rate(self, tax_type):
|
def get_tax_rate(self, tax_type):
|
||||||
return { "tax_rate": frappe.db.get_value("Account", tax_type, "tax_rate") }
|
return { "tax_rate": frappe.db.get_value("Account", tax_type, "tax_rate") }
|
||||||
|
|
||||||
def get_file_details(self, arg = ''):
|
|
||||||
file = frappe.db.sql("select file_group, description from tabFile where name = %s", eval(arg)['file_name'], as_dict = 1)
|
|
||||||
|
|
||||||
ret = {
|
|
||||||
'file_group' : file and file[0]['file_group'] or '',
|
|
||||||
'description' : file and file[0]['description'] or ''
|
|
||||||
}
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def on_trash(self):
|
def on_trash(self):
|
||||||
super(Item, self).on_trash()
|
super(Item, self).on_trash()
|
||||||
frappe.db.sql("""delete from tabBin where item_code=%s""", self.item_code)
|
frappe.db.sql("""delete from tabBin where item_code=%s""", self.item_code)
|
||||||
|
@ -102,7 +102,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
|||||||
method: 'erpnext.stock.doctype.stock_reconciliation.stock_reconciliation.upload'
|
method: 'erpnext.stock.doctype.stock_reconciliation.stock_reconciliation.upload'
|
||||||
},
|
},
|
||||||
sample_url: "e.g. http://example.com/somefile.csv",
|
sample_url: "e.g. http://example.com/somefile.csv",
|
||||||
callback: function(fid, filename, r) {
|
callback: function(attachment, r) {
|
||||||
me.frm.set_value("reconciliation_json", JSON.stringify(r.message));
|
me.frm.set_value("reconciliation_json", JSON.stringify(r.message));
|
||||||
me.show_reconciliation_data();
|
me.show_reconciliation_data();
|
||||||
me.frm.save();
|
me.frm.save();
|
||||||
|
@ -31,7 +31,7 @@ cur_frm.cscript.setup_upload = function() {
|
|||||||
select_doctype: cur_frm.doc.select_doctype
|
select_doctype: cur_frm.doc.select_doctype
|
||||||
},
|
},
|
||||||
sample_url: "e.g. http://example.com/somefile.csv",
|
sample_url: "e.g. http://example.com/somefile.csv",
|
||||||
callback: function(fid, filename, r) {
|
callback: function(attachment, r) {
|
||||||
$log.empty().html("<hr>");
|
$log.empty().html("<hr>");
|
||||||
$.each(r.message, function(i, v) {
|
$.each(r.message, function(i, v) {
|
||||||
$("<div>" + v + "</div>").appendTo($log);
|
$("<div>" + v + "</div>").appendTo($log);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user