Skip to content

Instantly share code, notes, and snippets.

@agritheory
Created November 18, 2019 16:13
Show Gist options
  • Save agritheory/6c6117f9a7b9d3c15a99e4c0f22a8024 to your computer and use it in GitHub Desktop.
Save agritheory/6c6117f9a7b9d3c15a99e4c0f22a8024 to your computer and use it in GitHub Desktop.
Patch a document method in Frappe
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment