One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| """ | |
| # graphql query to run in the playground | |
| { | |
| hello | |
| } | |
| """ | |
| from ariadne import QueryType, graphql, make_executable_schema | |
| from ariadne.constants import PLAYGROUND_HTML | |
| from quart import Quart, request, jsonify |
| #this can be done in a either a document hook or | |
| import types | |
| import rounding_error_monkey_patch | |
| doc = frappe.new_doc("Journal Entry") | |
| # monkey patch validate_invoices method to bypass (incorrect) rounding error | |
| doc.validate_invoices = types.MethodType(rounding_error_monkey_patch, doc) | |
| return doc |
| doc_events = { | |
| "Sales Order": { | |
| "on_submit": "my_custom_app.workflows.make_stock_entry_on_so_submit" | |
| }, | |
| "on_cancel": "my_custom_app.workflows.cancel_stock_entry_on_so_cancel" | |
| } | |
| } |
pycodestylepython -m pip install pycodestyle --userI use an 89 character line length and ignore these error codes:
| import asyncio | |
| from functools import wraps | |
| def dec(fn): | |
| @wraps(fn) | |
| async def wrapper(*args, **kwargs): | |
| print(fn, args, kwargs) # <function foo at 0x10952d598> () {} | |
| await asyncio.sleep(5) |
| from requests import request | |
| from base64 import b64encode | |
| api_secret = get_decrypted_password("User", "example_username", "api_secret") # this is an internal frappe method | |
| token = frappe.get_value("User", "example_username", "api_key") # this is an internal frappe method | |
| url = "https://" + subdomain + ".some_domain.com" | |
| headers = { | |
| "Content-Type": "application/json", | |
| "Authorization": "Basic " | |
| + b64encode(bytes(token + ":" + api_secret, "ascii")).decode("ascii"), |
| import csv | |
| import random | |
| import typing | |
| from pathlib import Path | |
| import mimesis | |
| def write_to_file(filename: str, data: list) -> typing.NoReturn: | |
| raw_path = Path(__file__).parent / filename |
| # on local machine generate public and private keys | |
| ssh-keygen -t ed25519 | |
| $ Generating public/private ed25519 key pair. | |
| $ Enter file in which to save the key (/home/tyler/.ssh/id_ed25519): deploy_key | |
| # add deploy_key.pub to github deploy keys via UI | |
| # add both keys to server | |
| # modify permissions |
| from frappe.modules.utils import export_customizations | |
| def export_dimension_fields(): | |
| doctypes = [ | |
| "GL Entry", | |
| "Sales Invoice", | |
| "Purchase Invoice", | |
| "Payment Entry", | |
| "Expense Claim Detail", | |
| "Expense Taxes and Charges", |