fix: merge branch 'develop'
This commit is contained in:
commit
babb226997
10 changed files with 40 additions and 16 deletions
|
|
@ -7,15 +7,20 @@ frappe.ui.form.on('Data Import', {
|
|||
frm.set_value("action", "");
|
||||
}
|
||||
|
||||
frm.set_query("reference_doctype", function() {
|
||||
return {
|
||||
"filters": {
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"name": ['in', frappe.boot.user.can_import]
|
||||
}
|
||||
};
|
||||
});
|
||||
frappe.call({
|
||||
method: "frappe.core.doctype.data_import.data_import.get_importable_doc",
|
||||
callback: function (r) {
|
||||
frm.set_query("reference_doctype", function () {
|
||||
return {
|
||||
"filters": {
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"name": ['in', r.message]
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
// should never check public
|
||||
frm.fields_dict["import_file"].df.is_private = 1;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ class DataImport(Document):
|
|||
upload(data_import_doc=self, from_data_import="Yes", validate_template=True)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_importable_doc():
|
||||
import_lst = frappe.cache().hget("can_import", frappe.session.user)
|
||||
return import_lst
|
||||
|
||||
@frappe.whitelist()
|
||||
def import_data(data_import):
|
||||
frappe.db.set_value("Data Import", data_import, "import_status", "In Progress", update_modified=False)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
"track_changes",
|
||||
"track_views",
|
||||
"allow_auto_repeat",
|
||||
"allow_import",
|
||||
"image_view",
|
||||
"column_break_5",
|
||||
"title_field",
|
||||
|
|
@ -167,13 +168,19 @@
|
|||
"fieldname": "allow_auto_repeat",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Auto Repeat"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "allow_import",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Import (via Data Import Tool)"
|
||||
}
|
||||
],
|
||||
"hide_toolbar": 1,
|
||||
"icon": "fa fa-glass",
|
||||
"idx": 1,
|
||||
"issingle": 1,
|
||||
"modified": "2019-07-01 22:50:50.372465",
|
||||
"modified": "2019-10-08 11:16:36.698006",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Custom",
|
||||
"name": "Customize Form",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ doctype_properties = {
|
|||
'max_attachments': 'Int',
|
||||
'track_changes': 'Check',
|
||||
'track_views': 'Check',
|
||||
'allow_auto_repeat': 'Check'
|
||||
'allow_auto_repeat': 'Check',
|
||||
'allow_import': 'Check'
|
||||
}
|
||||
|
||||
docfield_properties = {
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ def get_context(context):
|
|||
|
||||
attachments = self.get_attachment(doc)
|
||||
recipients, cc, bcc = self.get_list_of_recipients(doc, context)
|
||||
if not recipients:
|
||||
if not (recipients or cc or bcc):
|
||||
return
|
||||
sender = None
|
||||
if self.sender and self.sender_email:
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ def sync_events_from_google_calendar(g_calendar, method=None, page_length=10):
|
|||
except HttpError as err:
|
||||
frappe.throw(_("Google Calendar - Could not fetch event from Google Calendar, error code {0}.").format(err.resp.status))
|
||||
|
||||
for event in events.get("items"):
|
||||
for event in events.get("items", []):
|
||||
results.append(event)
|
||||
|
||||
if not events.get("nextPageToken"):
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ def sync_contacts_from_google_contacts(g_contact):
|
|||
except HttpError as err:
|
||||
frappe.throw(_("Google Contacts - Could not sync contacts from Google Contacts {0}, error code {1}.").format(account.name, err.resp.status))
|
||||
|
||||
for contact in contacts.get("connections"):
|
||||
for contact in contacts.get("connections", []):
|
||||
results.append(contact)
|
||||
|
||||
if not contacts.get("nextPageToken"):
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ def execute():
|
|||
|
||||
users = frappe.get_all('User', filters={"name": ('not in', 'Administrator, Guest')}, fields=["*"])
|
||||
for user in users:
|
||||
if frappe.db.exists("Contact", {"email_id": user.email}) or frappe.db.exists("Contact Email", {"email_id": user.email}):
|
||||
continue
|
||||
if user.first_name:
|
||||
user.first_name = re.sub("[<>]+", '', frappe.safe_decode(user.first_name))
|
||||
if user.last_name:
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import frappe
|
|||
|
||||
def execute():
|
||||
if frappe.db.table_exists('Prepared Report'):
|
||||
frappe.reload_doc("core", "doctype", "prepared_doctype")
|
||||
prepared_reports = frappe.get_all("Prepared Report")
|
||||
for report in prepared_reports:
|
||||
frappe.delete_doc("Prepared Report", report.name)
|
||||
|
|
|
|||
|
|
@ -157,8 +157,11 @@ class UserPermissions:
|
|||
self.can_read.remove(dt)
|
||||
|
||||
if "System Manager" in self.get_roles():
|
||||
self.can_import = list(filter(lambda d: d in self.can_create,
|
||||
frappe.db.sql_list("""select name from `tabDocType` where allow_import = 1""")))
|
||||
docs = [x["name"] for x in frappe.get_all("DocType", "name")]
|
||||
for docname in docs:
|
||||
if frappe.get_meta(docname, cached=False).allow_import == 1:
|
||||
self.can_import.append(docname)
|
||||
frappe.cache().hset("can_import", frappe.session.user, self.can_import)
|
||||
|
||||
def get_defaults(self):
|
||||
import frappe.defaults
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue