Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

22 rader
680 B

  1. from __future__ import unicode_literals
  2. import frappe
  3. def execute():
  4. # patch for all Email Account with the flag use_imap
  5. for email_account in frappe.get_list("Email Account", filters={"enable_incoming": 1, "use_imap": 1}):
  6. # get all data from Email Account
  7. doc = frappe.get_doc("Email Account", email_account.name)
  8. imap_list = [folder.folder_name for folder in doc.imap_folder]
  9. # and append the old data to the child table
  10. if doc.uidvalidity or doc.uidnext and "INBOX" not in imap_list:
  11. doc.append("imap_folder", {
  12. "folder_name": "INBOX",
  13. "append_to": doc.append_to,
  14. "uid_validity": doc.uidvalidity,
  15. "uidnext": doc.uidnext,
  16. })
  17. doc.save()