fix: Timeout error while saving the purchase invoice (#33577)

* fix: timeout error in the Purchase Invoice

(cherry picked from commit 7249657d15)

* feat: provision to disable get last purchase rate
fix: set_incoming_rate condition

(cherry picked from commit d1d4671320)

* fix: linters issue

(cherry picked from commit 05df8579cd)

* test: test case to check disable last purchase rate

(cherry picked from commit ec171fc7c1)

Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2023-01-10 09:02:15 +05:30
committed by GitHub
parent a92b4e7255
commit d2e3701b1a
5 changed files with 74 additions and 15 deletions

View File

@@ -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"]: