feat: provision to disable get last purchase rate
fix: set_incoming_rate condition
This commit is contained in:
parent
7249657d15
commit
d1d4671320
@ -9,8 +9,8 @@
|
||||
"supplier_and_price_defaults_section",
|
||||
"supp_master_name",
|
||||
"supplier_group",
|
||||
"column_break_4",
|
||||
"buying_price_list",
|
||||
"column_break_4",
|
||||
"maintain_same_rate_action",
|
||||
"role_to_override_stop_action",
|
||||
"transaction_settings_section",
|
||||
@ -20,6 +20,7 @@
|
||||
"maintain_same_rate",
|
||||
"allow_multiple_items",
|
||||
"bill_for_rejected_quantity_in_purchase_invoice",
|
||||
"disable_last_purchase_rate",
|
||||
"subcontract",
|
||||
"backflush_raw_materials_of_subcontract_based_on",
|
||||
"column_break_11",
|
||||
@ -71,7 +72,7 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "subcontract",
|
||||
"fieldtype": "Section Break",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Subcontracting Settings"
|
||||
},
|
||||
{
|
||||
@ -118,8 +119,8 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "supplier_and_price_defaults_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Supplier and Price Defaults"
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Naming Series and Price Defaults"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_4",
|
||||
@ -127,12 +128,18 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "transaction_settings_section",
|
||||
"fieldtype": "Section Break",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Transaction Settings"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_12",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "disable_last_purchase_rate",
|
||||
"fieldtype": "Check",
|
||||
"label": "Disable Last Purchase Rate"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-cog",
|
||||
@ -140,7 +147,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2022-09-27 10:50:27.050252",
|
||||
"modified": "2023-01-09 17:08:28.828173",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Buying Settings",
|
||||
|
@ -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"]:
|
||||
|
@ -279,7 +279,7 @@ class Item(Document):
|
||||
frappe.throw(_("Row #{0}: Maximum Net Rate cannot be greater than Minimum Net Rate"))
|
||||
|
||||
def update_template_tables(self):
|
||||
template = frappe.get_doc("Item", self.variant_of)
|
||||
template = frappe.get_cached_doc("Item", self.variant_of)
|
||||
|
||||
# add item taxes from template
|
||||
for d in template.get("taxes"):
|
||||
|
@ -813,6 +813,9 @@ def get_price_list_rate(args, item_doc, out=None):
|
||||
flt(price_list_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate)
|
||||
)
|
||||
|
||||
if frappe.db.get_single_value("Buying Settings", "disable_last_purchase_rate"):
|
||||
return out
|
||||
|
||||
if not out.price_list_rate and args.transaction_type == "buying":
|
||||
from erpnext.stock.doctype.item.item import get_last_purchase_details
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user