diff --git a/erpnext/buying/utils.py b/erpnext/buying/utils.py index cf815835553c6cc24e83cc35f85b4a8c54abebed..b8f8ade233f368d190f1b1baa1c6a1b925007c75 100644 --- a/erpnext/buying/utils.py +++ b/erpnext/buying/utils.py @@ -15,6 +15,9 @@ def update_last_purchase_rate(doc, is_submit) -> None: """updates last_purchase_rate in item table for each item""" import frappe.utils + if doc.get("is_internal_supplier"): + return + this_purchase_date = getdate(doc.get("posting_date") or doc.get("transaction_date")) for d in doc.get("items"): diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 7ef86fce3519e2c76326c5cfa533e22807aa816f..4432167f8e4e73c1751aa327600b352e4d41b071 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -561,6 +561,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe quotation_to: me.frm.doc.quotation_to, supplier: me.frm.doc.supplier, 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, conversion_rate: me.frm.doc.conversion_rate, price_list: me.frm.doc.selling_price_list || me.frm.doc.buying_price_list, @@ -1683,7 +1685,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, "conversion_factor": me.frm.doc.conversion_factor, "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, }; } diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 6827c0c9a4de84f6633593090fbd33cea5ca0cb2..94eb6d3005ff73327370af5bb8885bab7456f4c0 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -855,6 +855,9 @@ def get_price_list_rate(args, item_doc, out=None): if price_list_rate is None or frappe.db.get_single_value( "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: insert_item_price(args) @@ -868,7 +871,11 @@ def get_price_list_rate(args, item_doc, out=None): 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": + 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 out.update(get_last_purchase_details(item_doc.name, args.name, args.conversion_rate))