diff --git a/js/legacy/widgets/form/form.js b/js/legacy/widgets/form/form.js
index 18b118fcb8..a30c05786a 100644
--- a/js/legacy/widgets/form/form.js
+++ b/js/legacy/widgets/form/form.js
@@ -43,7 +43,7 @@ wn.provide('_f');
_f.frms = {};
-_f.Frm = function(doctype, parent) {
+_f.Frm = function(doctype, parent, in_form) {
this.docname = '';
this.doctype = doctype;
this.display = 0;
@@ -61,6 +61,9 @@ _f.Frm = function(doctype, parent) {
this.setup_meta(doctype);
+ // show in form instead of in dialog, when called using url (router.js)
+ this.in_form = in_form ? true : false;
+
// notify on rename
var me = this;
$(document).bind('rename', function(event, dt, old_name, new_name) {
@@ -142,8 +145,8 @@ _f.Frm.prototype.onhide = function() { if(_f.cur_grid_cell) _f.cur_grid_cell.gri
_f.Frm.prototype.setup_std_layout = function() {
this.page_layout = new wn.PageLayout({
parent: this.wrapper,
- main_width: this.meta.in_dialog ? '100%' : '75%',
- sidebar_width: this.meta.in_dialog ? '0%' : '25%'
+ main_width: (this.meta.in_dialog && !this.in_form) ? '100%' : '75%',
+ sidebar_width: (this.meta.in_dialog && !this.in_form) ? '0%' : '25%'
})
// only tray
@@ -153,7 +156,7 @@ _f.Frm.prototype.setup_std_layout = function() {
this.layout = new Layout(this.page_layout.body, '100%');
// sidebar
- if(this.meta.in_dialog) {
+ if(this.meta.in_dialog && !this.in_form) {
// hide sidebar
$(this.page_layout.wrapper).removeClass('layout-wrapper-background');
$(this.page_layout.main).removeClass('layout-main-section');
@@ -168,7 +171,7 @@ _f.Frm.prototype.setup_std_layout = function() {
// header - no headers for tables and guests
- if(!(this.meta.istable || user=='Guest' || this.meta.in_dialog))
+ if(!(this.meta.istable || user=='Guest' || (this.meta.in_dialog && !this.in_form)))
this.frm_head = new _f.FrmHeader(this.page_layout.head, this);
// bg colour
@@ -246,7 +249,7 @@ _f.Frm.prototype.email_doc = function() {
_f.Frm.prototype.rename_notify = function(dt, old, name) {
// from form
- if(this.meta.in_dialog)
+ if(this.meta.in_dialog && !this.in_form)
return;
if(this.docname == old)
@@ -276,7 +279,7 @@ _f.Frm.prototype.rename_notify = function(dt, old, name) {
// ======================================================================================
-_f.Frm.prototype.setup_meta = function() {
+_f.Frm.prototype.setup_meta = function(doctype) {
this.meta = get_local('DocType',this.doctype);
this.perm = get_perm(this.doctype); // for create
if(this.meta.istable) { this.meta.in_dialog = 1 }
@@ -471,7 +474,7 @@ _f.Frm.prototype.get_doc_perms = function() {
_f.Frm.prototype.refresh_header = function() {
// set title
// main title
- if(!this.meta.in_dialog) {
+ if(!this.meta.in_dialog || this.in_form) {
set_title(this.meta.issingle ? this.doctype : this.docname);
}
@@ -514,7 +517,7 @@ _f.Frm.prototype.check_doc_perm = function() {
_f.Frm.prototype.refresh = function(docname) {
// record switch
if(docname) {
- if(this.docname != docname && !this.meta.in_dialog && !this.meta.istable) scroll(0, 0);
+ if(this.docname != docname && (!this.meta.in_dialog || this.in_form) && !this.meta.istable) scroll(0, 0);
this.docname = docname;
}
if(!this.meta.istable) {
@@ -613,7 +616,7 @@ _f.Frm.prototype.refresh = function(docname) {
_f.Frm.prototype.refresh_footer = function() {
var f = this.page_layout.footer;
if(f.save_area) {
- if(get_url_arg('embed') || (this.editable && !this.meta.in_dialog && this.doc.docstatus==0 && !this.meta.istable && this.get_doc_perms()[WRITE])) {
+ if(get_url_arg('embed') || (this.editable && (!this.meta.in_dialog || this.in_form) && this.doc.docstatus==0 && !this.meta.istable && this.get_doc_perms()[WRITE])) {
f.show_save();
} else {
f.hide_save();
diff --git a/js/legacy/wn/widgets/form/attachments.js b/js/legacy/wn/widgets/form/attachments.js
index 8df6c4ca7f..fa263d28fc 100644
--- a/js/legacy/wn/widgets/form/attachments.js
+++ b/js/legacy/wn/widgets/form/attachments.js
@@ -117,7 +117,7 @@ wn.widgets.form.sidebar.Attachment = function(parent, filedet, frm) {
// download
var display_name = this.fileid;
- if(this.fileid.substr(0,8)=='FileData')
+ if(this.fileid && this.fileid.substr(0,8)=='FileData')
display_name = this.filename;
this.ln = $a(this.wrapper, 'a', 'link_type small', {}, display_name);
this.ln.href = 'files/'+this.fileid;
diff --git a/js/wn/views/formview.js b/js/wn/views/formview.js
index fff3bef332..b6c6926c04 100644
--- a/js/wn/views/formview.js
+++ b/js/wn/views/formview.js
@@ -19,7 +19,7 @@ wn.views.formview = {
}
if(!wn.views.formview[dt]) {
wn.views.formview[dt] = wn.container.add_page('Form - ' + dt);
- wn.views.formview[dt].frm = new _f.Frm(dt, wn.views.formview[dt]);
+ wn.views.formview[dt].frm = new _f.Frm(dt, wn.views.formview[dt], true);
}
wn.container.change_to('Form - ' + dt);
wn.views.formview[dt].frm.refresh(dn);
diff --git a/py/core/page/data_import_tool/data_import_tool.py b/py/core/page/data_import_tool/data_import_tool.py
index 6063b600f8..b0f2513428 100644
--- a/py/core/page/data_import_tool/data_import_tool.py
+++ b/py/core/page/data_import_tool/data_import_tool.py
@@ -30,7 +30,7 @@ def get_template():
doctype_dl = webnotes.model.doctype.get(doctype)
tablecolumns = [f[0] for f in webnotes.conn.sql('desc `tab%s`' % doctype)]
-
+
def getinforow(docfield):
"""make info comment"""
if docfield.fieldtype == 'Select':
@@ -68,7 +68,7 @@ def get_template():
def append_row(t, mandatory):
docfield = getdocfield(t)
if docfield and ((mandatory and docfield.reqd) or (not mandatory and not docfield.reqd)) \
- and (t not in ('parenttype', 'trash_reason')):
+ and (t not in ('parenttype', 'trash_reason', 'file_list')):
fieldrow.append(t)
mandatoryrow.append(docfield.reqd and 'Yes' or 'No')
typerow.append(docfield.fieldtype)
@@ -153,7 +153,11 @@ def upload():
# doctype
doctype = rows[0][0].split(':')[1].strip()
doctype_dl = webnotes.model.doctype.get(doctype, form=0)
-
+
+ if doctype in ['Customer', 'Supplier'] and len(rows[8:]) > 100:
+ webnotes.msgprint("Please upload only upto 100 %ss at a time" % doctype)
+ raise Exception
+
parenttype, parentfield = None, None
if len(rows[1]) > 0 and ':' in rows[1][0]:
parenttype = rows[1][0].split(':')[1].strip()
diff --git a/py/webnotes/utils/email_lib/__init__.py b/py/webnotes/utils/email_lib/__init__.py
index 37411b7513..58ea04bcf7 100644
--- a/py/webnotes/utils/email_lib/__init__.py
+++ b/py/webnotes/utils/email_lib/__init__.py
@@ -66,14 +66,21 @@ def sendmail(recipients, sender='', msg='', subject='[No Subject]', txt=None, \
# if not html, then lets put some whitespace
if (not '
' in msg) and (not '
' in msg):
msg = msg.replace('\n','
')
-
+
footer = get_footer()
+
+ # encode using utf-8
+ footer = footer.encode('utf-8', 'ignore')
+
msg = msg + (footer or '')
if txt:
email.set_text(txt)
else:
try:
- email.set_text(html2text(msg))
+ msg_unicode = msg
+ if isinstance(msg, str):
+ msg_unicode = unicode(msg, 'utf-8', 'ignore')
+ email.set_text(html2text(msg_unicode))
except HTMLParser.HTMLParseError:
pass
email.set_html(msg)