This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sade = require("sade"); | |
const os = require("os"); | |
const { MultiSelect } = require("enquirer"); | |
const fs = require("fs-extra"); | |
const today = sade("today"); | |
function getCurrentUser() { | |
return os.userInfo().username; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if not doc.is_new() and frappe.session.user!="admin@example.com": | |
frappe.throw("You're not allowed to change this information after saving") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Copyright (c) 2019, Frappe Technologies and contributors | |
# For license information, please see license.txt | |
from __future__ import unicode_literals | |
import frappe | |
import glob | |
import os | |
from frappe.utils import split_emails, get_backups_path, get_files_path | |
from frappe.utils.backups import BackupGenerator, new_backup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import os | |
def resize_images(path): | |
size = (600, 600) | |
for basepath, folders, files in os.walk(path): | |
for fname in files: | |
extn = fname.rsplit(".", 1)[1] | |
if extn in ("jpg", "jpeg", "png", "gif", "JPG"): | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@frappe.whitelist() | |
def send_invoice(doctype, docname, subject, message, recipient): | |
attachments = [] | |
print_formats = ["PF1", "PF2", "PF3"] | |
for format_name in print_formats: | |
filename = docname + "" + format_name | |
pdf_attach = frappe.attach_print(doctype, docname, file_name=filename, print_format=format_name) | |
attachments.append(pdf_attach) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def append_hook(target, key, value): | |
if isinstance(value, dict): | |
# dict? make a list of values against each key | |
target.setdefault(key, {}) | |
for inkey in value: | |
append_hook(target[key], inkey, value[inkey]) | |
else: | |
# make a list | |
target.setdefault(key, []) | |
if not isinstance(value, list): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="contributors-grid"></div> | |
<style> | |
#contributors-grid { | |
display: grid; | |
grid-template-columns: repeat(14, 1fr); | |
grid-column-gap: 5px; | |
grid-row-gap: 8px; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome | |
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) | |
*/ | |
/* FONT PATH | |
* -------------------------- */ | |
@import url(/assets/frappe_theme/css/inter.css); | |
@font-face { | |
font-family: 'FontAwesome'; | |
src: url("/assets/frappe/css/fonts/fontawesome/fontawesome-webfont.eot?v=4.7.0"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a reCaptcha v2 on https://www.google.com/recaptcha/admin/ | |
// Copy the site key and paste it below | |
// Add a HTML field in the Lead DocType with fieldname "captcha_html_wrapper" | |
// Add the HTML field at the end of the fields child table | |
// Add the following to web form script | |
frappe.require("https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&type=api.js") | |
let el = document.querySelector('[data-fieldname="captcha_html_wrapper"]'); | |
window.captcha_failed = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Migrating erpnext-dev | |
Executing erpnext.patches.v13_0.move_tax_slabs_from_payroll_period_to_income_tax_slab #123 in erpnext-dev (_0acfbbe28584367f) | |
Traceback (most recent call last): | |
File "/Users/shivammishra/Projects/ERPNext/frappe-bench/apps/frappe/frappe/modules/utils.py", line 204, in load_doctype_module | |
doctype_python_modules[key] = frappe.get_module(module_name) | |
File "/Users/shivammishra/Projects/ERPNext/frappe-bench/apps/frappe/frappe/__init__.py", line 842, in get_module | |
return importlib.import_module(modulename) | |
File "/Users/shivammishra/Projects/ERPNext/frappe-bench/env/lib/python3.7/importlib/__init__.py", line 127, in import_module | |
return _bootstrap._gcd_import(name[level:], package, level) | |
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import |