Both of them create gl entry submit and preview


both of them call make_gl_entries method
what the diff between them?!

When you click the “Accounting Ledger” button, it makes GL entries but rolls back the transaction.

Check below code for reference

1 Like

okey this good
how could i fire method when the gl entry insert and not rollback?

For these types of tasks, there are many solutions depending on the scenario and the way you want to approach them.

  • Check whether the request path is different using frappe.local.request.path for both requests?

or

  • You can set flags (frappe.flags.gl_preview = true) and check in your code if frappe.flags.gl_preview is true, but for this, you will have to override the stock_controller.py code or other ERPNext file code.


i commet this code
but


did not create in db?!

If you are making changes directly on the server, then you should run the bench restart command to take effect.

i did it
but no thing effect happend i test it by throw the Test first and its worked with me then i commet it but no thing happend with me

try replacing frappe.db.rollback() with frappe.db.commit()

this code is framework not mine

You were making changes to the framework code, which is why I suggested you do that. As I already mentioned, you will have to override methods to make changes. :blush:

i understand you
but based there code the rollback effect but we did not find the real data that the rollback rollback it

Just for testing, add a commit and check if records are inserted into the database. Don’t forget to run the restart command after making changes.

by the way the reverse entry does not appear in general entry
but still in gl entry and still make gl entry in submit or cancel

this create gl entry

Actually, I am not from an accounting background, so I don’t know what a reverse GL entry is. :sweat_smile:

Some GL entries (passed via journal vouchers like period close vouchers, provisions and other account closing adjustments) are posted and need to be reversed to remove the impact of those transactions. They are like temporary entries posted to show true and fair accounting status as of the closing report date. However, since these transactions are more estimation-based, they need to be reversed.