def clean_all_descriptions(): for item in frappe.get_all('Item', ['name', 'description']): if item.description: clean_description = clean_html(item.description) if item.description != clean_description: frappe.db.set_value('Item', item.name, 'description', clean_description)
def validate_description(self): '''Clean HTML description if set''' if cint(frappe.db.get_single_value('Stock Settings', 'clean_description_html')): self.description = clean_html(self.description) if self.description: self.description = self.description.strip()
def validate_description(self): '''Clean HTML description if set''' if cint(frappe.db.get_single_value('Stock Settings', 'clean_description_html')): self.description = clean_html(self.description)
def validate(self): super(ItemGroup, self).validate() self.description = clean_html(self.description) self.make_route()
def add_pdf(doc): envlop_file_name = frappe.generate_hash(length=12) shareable_file_name = frappe.generate_hash(length=12) lab_test_doc = frappe.get_doc("Lab Test", doc) ftp = FTP('ftp.saudigenome.net') ftp.login(user='******', passwd='216408Mm') print(ftp.getwelcome()) #upload test_result filename = get_file_path(lab_test_doc.lab_test_result_file[7:]) # print ("\nfilename 1= {} \n ".format(filename)) file = open(filename, 'rb') ftp.storbinary( 'STOR ' + lab_test_doc.lab_test_result_file[7:].encode('utf-8').decode('utf-8'), file) file.close() #upload arabic_result filename = get_file_path(lab_test_doc.arabic_result_file[7:]) # print ("\nfilename 2= {} \n ".format(filename)) file = open(filename, 'rb') ftp.storbinary( 'STOR ' + lab_test_doc.arabic_result_file[7:].encode('utf-8').decode('utf-8'), file) file.close() #upload envlop_file html_data1 = frappe.render_template( "templates/envlop.html", { "patient_name": lab_test_doc.arabic_first_name, "disease": clean_html(lab_test_doc.disease_description), "file1": lab_test_doc.lab_test_result_file[7:], "file2": lab_test_doc.arabic_result_file[7:], "shareable_file_name": shareable_file_name, "hash_id": lab_test_doc.hash_id }) envlop_file = save_generated_file(html_data1, envlop_file_name) filename = get_file_path(envlop_file) # print ("\n envlop_file = {} filename 3= {} \n ".format(envlop_file,filename)) file = open(filename, 'rb') ftp.storbinary('STOR ' + envlop_file, file) file.close() # upload shareable_file disease_doc = frappe.get_doc("Diseases", lab_test_doc.disease) html_data2 = frappe.render_template( "templates/shareable_file.html", { "disease": disease_doc.name, "disease_story": disease_doc.description, "html_pattern": disease_doc.html_pattern, "hash_id": lab_test_doc.hash_id }) shareable_file = save_generated_file(html_data2, shareable_file_name) filename = get_file_path(shareable_file) print("\n shareable_file = {} filename 4= {} \n ".format( envlop_file, filename)) file = open(filename, 'rb') ftp.storbinary('STOR ' + shareable_file, file) file.close() ftp.quit() # print ("\nuploaded \n") return envlop_file_name
def validate_description(self): """Clean HTML description if set""" if cint( frappe.db.get_single_value("Stock Settings", "clean_description_html")): self.description = clean_html(self.description)
def clean_all_descriptions(): for item in frappe.get_all("Item", ["name", "description"]): if item.description: clean_description = clean_html(item.description) if item.description != clean_description: frappe.db.set_value("Item", item.name, "description", clean_description)