fix: do not update item price and last purchase rate for inter transf… (#42616)
fix: do not update item price and last purchase rate for inter transfer transaction
This commit is contained in:
@@ -14,6 +14,9 @@ from erpnext.stock.doctype.item.item import get_last_purchase_details, validate_
|
|||||||
def update_last_purchase_rate(doc, is_submit) -> None:
|
def update_last_purchase_rate(doc, is_submit) -> None:
|
||||||
"""updates last_purchase_rate in item table for each item"""
|
"""updates last_purchase_rate in item table for each item"""
|
||||||
|
|
||||||
|
if doc.get("is_internal_supplier"):
|
||||||
|
return
|
||||||
|
|
||||||
this_purchase_date = getdate(doc.get("posting_date") or doc.get("transaction_date"))
|
this_purchase_date = getdate(doc.get("posting_date") or doc.get("transaction_date"))
|
||||||
|
|
||||||
for d in doc.get("items"):
|
for d in doc.get("items"):
|
||||||
|
|||||||
@@ -534,6 +534,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
quotation_to: me.frm.doc.quotation_to,
|
quotation_to: me.frm.doc.quotation_to,
|
||||||
supplier: me.frm.doc.supplier,
|
supplier: me.frm.doc.supplier,
|
||||||
currency: me.frm.doc.currency,
|
currency: me.frm.doc.currency,
|
||||||
|
is_internal_supplier: me.frm.doc.is_internal_supplier,
|
||||||
|
is_internal_customer: me.frm.doc.is_internal_customer,
|
||||||
update_stock: update_stock,
|
update_stock: update_stock,
|
||||||
conversion_rate: me.frm.doc.conversion_rate,
|
conversion_rate: me.frm.doc.conversion_rate,
|
||||||
price_list: me.frm.doc.selling_price_list || me.frm.doc.buying_price_list,
|
price_list: me.frm.doc.selling_price_list || me.frm.doc.buying_price_list,
|
||||||
@@ -1660,7 +1662,9 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
"update_stock": ['Sales Invoice', 'Purchase Invoice'].includes(me.frm.doc.doctype) ? cint(me.frm.doc.update_stock) : 0,
|
"update_stock": ['Sales Invoice', 'Purchase Invoice'].includes(me.frm.doc.doctype) ? cint(me.frm.doc.update_stock) : 0,
|
||||||
"conversion_factor": me.frm.doc.conversion_factor,
|
"conversion_factor": me.frm.doc.conversion_factor,
|
||||||
"pos_profile": me.frm.doc.doctype == 'Sales Invoice' ? me.frm.doc.pos_profile : '',
|
"pos_profile": me.frm.doc.doctype == 'Sales Invoice' ? me.frm.doc.pos_profile : '',
|
||||||
"coupon_code": me.frm.doc.coupon_code
|
"coupon_code": me.frm.doc.coupon_code,
|
||||||
|
"is_internal_supplier": me.frm.doc.is_internal_supplier,
|
||||||
|
"is_internal_customer": me.frm.doc.is_internal_customer,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -820,6 +820,9 @@ def get_price_list_rate(args, item_doc, out=None):
|
|||||||
if price_list_rate is None or frappe.db.get_single_value(
|
if price_list_rate is None or frappe.db.get_single_value(
|
||||||
"Stock Settings", "update_existing_price_list_rate"
|
"Stock Settings", "update_existing_price_list_rate"
|
||||||
):
|
):
|
||||||
|
if args.get("is_internal_supplier") or args.get("is_internal_customer"):
|
||||||
|
return out
|
||||||
|
|
||||||
if args.price_list and args.rate:
|
if args.price_list and args.rate:
|
||||||
insert_item_price(args)
|
insert_item_price(args)
|
||||||
|
|
||||||
@@ -831,7 +834,11 @@ def get_price_list_rate(args, item_doc, out=None):
|
|||||||
if frappe.db.get_single_value("Buying Settings", "disable_last_purchase_rate"):
|
if frappe.db.get_single_value("Buying Settings", "disable_last_purchase_rate"):
|
||||||
return out
|
return out
|
||||||
|
|
||||||
if not out.price_list_rate and args.transaction_type == "buying":
|
if (
|
||||||
|
not args.get("is_internal_supplier")
|
||||||
|
and not out.price_list_rate
|
||||||
|
and args.transaction_type == "buying"
|
||||||
|
):
|
||||||
from erpnext.stock.doctype.item.item import get_last_purchase_details
|
from erpnext.stock.doctype.item.item import get_last_purchase_details
|
||||||
|
|
||||||
out.update(get_last_purchase_details(item_doc.name, args.name, args.conversion_rate))
|
out.update(get_last_purchase_details(item_doc.name, args.name, args.conversion_rate))
|
||||||
|
|||||||
Reference in New Issue
Block a user