Problem: Making a PE from PO led to incorrect values in PE form since PO's default party_account_currency is the company's currency (#15153)
Fix: PO will set party_account_currency to supplier's default currency on validation.
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index a543c20..ed761ce 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -13,6 +13,7 @@
from frappe.desk.notifications import clear_doctype_notifications
from erpnext.buying.utils import validate_for_items, check_for_closed_status
from erpnext.stock.utils import get_bin
+from erpnext.accounts.party import get_party_account_currency
from six import string_types
from erpnext.stock.doctype.item.item import get_item_defaults
from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
@@ -87,6 +88,8 @@
standing = frappe.db.get_value("Supplier Scorecard",self.supplier, 'status')
frappe.msgprint(_("{0} currently has a {1} Supplier Scorecard standing, and Purchase Orders to this supplier should be issued with caution.").format(self.supplier, standing), title=_("Caution"), indicator='orange')
+ self.party_account_currency = get_party_account_currency("Supplier", self.supplier, self.company)
+
def validate_minimum_order_qty(self):
items = list(set([d.item_code for d in self.get("items")]))