Skip to content

Commit

Permalink
refactor: update project costing based on frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Nov 24, 2023
1 parent 0fe6dcd commit dd016e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,11 @@ def on_submit(self):
if self.update_stock == 1:
self.repost_future_sle_and_gle()

self.update_project()
if (
frappe.db.get_single_value("Buying Settings", "project_update_frequency") == "Each Transaction"
):
self.update_project()

update_linked_doc(self.doctype, self.name, self.inter_company_invoice_reference)
self.update_advance_tax_references()

Expand Down Expand Up @@ -1262,7 +1266,10 @@ def on_cancel(self):
if self.update_stock == 1:
self.repost_future_sle_and_gle()

self.update_project()
if (
frappe.db.get_single_value("Buying Settings", "project_update_frequency") == "Each Transaction"
):
self.update_project()
self.db_set("status", "Cancelled")

unlink_inter_company_doc(self.doctype, self.name, self.inter_company_invoice_reference)
Expand Down
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -351,5 +351,6 @@ erpnext.patches.v15_0.rename_depreciation_amount_based_on_num_days_in_month_to_d
erpnext.patches.v15_0.set_reserved_stock_in_bin
erpnext.patches.v14_0.create_accounting_dimensions_in_supplier_quotation
erpnext.patches.v14_0.update_zero_asset_quantity_field
execute:frappe.db.set_single_value("Buying Settings", "project_update_frequency", "Each Transaction")
# below migration patch should always run last
erpnext.patches.v14_0.migrate_gl_to_payment_ledger

0 comments on commit dd016e6

Please sign in to comment.