[webform][attachments] allow saving filename, insert file path later

This commit is contained in:
Prateeksha Singh 2018-08-23 10:03:28 +05:30
parent 78d061ced5
commit 9f04cfc968

View file

@ -380,7 +380,8 @@ def accept(web_form, data, for_payment=False):
if df and df.fieldtype in ('Attach', 'Attach Image'):
if value and 'data:' and 'base64' in value:
files.append((fieldname, value))
doc.set(fieldname, '')
if not doc.name:
doc.set(fieldname, '')
continue
elif not value and doc.get(fieldname):
@ -404,7 +405,9 @@ def accept(web_form, data, for_payment=False):
if web_form.login_required and frappe.session.user=="Guest":
frappe.throw(_("You must login to submit this form"))
doc.insert(ignore_permissions = True, ignore_mandatory = True if files else False)
ignore_mandatory = True if files else False
doc.insert(ignore_permissions = True, ignore_mandatory = ignore_mandatory)
# add files
if files: