Created
November 18, 2019 16:13
-
-
Save agritheory/6c6117f9a7b9d3c15a99e4c0f22a8024 to your computer and use it in GitHub Desktop.
Patch a document method in Frappe
This file contains hidden or 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
#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