Skip to content

Instantly share code, notes, and snippets.

View barredterra's full-sized avatar

Raffael Meyer barredterra

View GitHub Profile
@barredterra
barredterra / snapaddy-privacy.md
Created March 4, 2024 09:47
Privacy policy for SnapADDY-ERPNext integration

This app operates on your local system only.

  • It does not transfer any data to the provider of the app.
  • It does not allow the provider of the app to access your data.

This app enables your system to accept data via an authenticated webhook and create a Lead record from this data. It will respond with an error message or with a link to the newly created Lead. If a duplicate Lead exists in the system already, it will respond with a link to the existing Lead. Thus, the authenticated caller of the webhook (usually snapADDY) will receive information about the ID of the Lead and any error messages (possibly along with stack traces).

@barredterra
barredterra / system_console.py
Last active February 5, 2024 19:56
Fix Timesheet Billing Status
# When a Sales Invoice is submitted, amended and cancelled multiple times, Timesheets might end up in the "Submitted" status
# while they are in fact billed.
#
# This script iterates over submitted, unbilled Timesheets. If the Timesheet is linked to a paid Sales Invoice, it
# will be marked as fully billed.
#
# This script can be run in the ERPNext System Console. First, make a dry run with the "Commit" checkbox deactivated. This
# will show all affected timesheets. Then activate "Commit", if you want to persist the fixes.
log("Fixed Timesheets:")
@barredterra
barredterra / dialog_promise.js
Last active March 3, 2023 19:39
Comfortably work with dialogs in Frappe Framework
function dialog_promise (title, fields, primary_action_label) {
// Return a function that returns a promise
// The promise resolves when the dialog is submitted and rejects when the dialog is closed
// On resolve, the promise returns the values from the dialog.
return () => new Promise((resolve, reject) => {
const dialog = new frappe.ui.Dialog({
title: title,
fields: fields,
onhide: () => reject(),
primary_action_label: primary_action_label,
@barredterra
barredterra / address.js
Last active June 23, 2021 12:11
ERPNext: automatically set Tax Category in Address DocType
// Client Script
frappe.ui.form.on("Address", {
refresh(frm) {
frm.trigger("set_tax_category");
},
country(frm) {
frm.trigger("set_tax_category");
},
links(frm) {
frm.trigger("set_tax_category");