feat: provision to disable get last purchase rate

fix: set_incoming_rate condition
This commit is contained in:
Rohit Waghchaure
2023-01-09 15:12:46 +05:30
parent 7249657d15
commit d1d4671320
4 changed files with 24 additions and 12 deletions

View File

@@ -274,9 +274,7 @@ class BuyingController(SubcontractingController):
if self.doctype not in ("Purchase Receipt", "Purchase Invoice", "Purchase Order"):
return
if (
self.doctype == "Purchase Invoice" and not self.update_stock and not self.is_internal_transfer()
):
if not self.is_internal_transfer():
return
ref_doctype_map = {
@@ -549,7 +547,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):
@@ -558,7 +558,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"]: