I am overriding one of the
Controller hook method called
after_insert to query to the database. Current document which is being inserted is not present in the query yet even though I am utilizing the
Is it possible to flush the transaction in frappe? I need to perform the query and cannot use the
self from the document because there is a lot of heavy lifting going on in the SQL query. Code sample:
class SalesInvoice(BaseSalesInvoice): def after_insert(self): # In reality the following query is very vast and I need to include the record being just created records = frappe.db.sql("SELECT * from `tabSales Invoice` WHERE `tabSales Invoice`.name = %(name)s" % dict(name = self.name)) print('Found total %d records % len(records))
What do you suggest here?