fix: Timeout error while saving the purchase invoice (#33577)
* fix: timeout error in the Purchase Invoice (cherry picked from commit7249657d15) * feat: provision to disable get last purchase rate fix: set_incoming_rate condition (cherry picked from commitd1d4671320) * fix: linters issue (cherry picked from commit05df8579cd) * test: test case to check disable last purchase rate (cherry picked from commitec171fc7c1) Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -278,6 +278,9 @@ class BuyingController(SubcontractingController):
|
||||
if self.doctype not in ("Purchase Receipt", "Purchase Invoice", "Purchase Order"):
|
||||
return
|
||||
|
||||
if not self.is_internal_transfer():
|
||||
return
|
||||
|
||||
ref_doctype_map = {
|
||||
"Purchase Order": "Sales Order Item",
|
||||
"Purchase Receipt": "Delivery Note Item",
|
||||
@@ -548,7 +551,9 @@ class BuyingController(SubcontractingController):
|
||||
self.process_fixed_asset()
|
||||
self.update_fixed_asset(field)
|
||||
|
||||
if self.doctype in ["Purchase Order", "Purchase Receipt"]:
|
||||
if self.doctype in ["Purchase Order", "Purchase Receipt"] and not frappe.db.get_single_value(
|
||||
"Buying Settings", "disable_last_purchase_rate"
|
||||
):
|
||||
update_last_purchase_rate(self, is_submit=1)
|
||||
|
||||
def on_cancel(self):
|
||||
@@ -557,7 +562,9 @@ class BuyingController(SubcontractingController):
|
||||
if self.get("is_return"):
|
||||
return
|
||||
|
||||
if self.doctype in ["Purchase Order", "Purchase Receipt"]:
|
||||
if self.doctype in ["Purchase Order", "Purchase Receipt"] and not frappe.db.get_single_value(
|
||||
"Buying Settings", "disable_last_purchase_rate"
|
||||
):
|
||||
update_last_purchase_rate(self, is_submit=0)
|
||||
|
||||
if self.doctype in ["Purchase Receipt", "Purchase Invoice"]:
|
||||
|
||||
Reference in New Issue
Block a user