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.
This commit is contained in:
Saif 2018-08-20 17:27:00 +05:00 committed by Nabin Hait
parent a09a8c3bf7
commit 15636a3b98

View File

@ -13,6 +13,7 @@ from erpnext.stock.stock_balance import update_bin_qty, get_ordered_qty
from frappe.desk.notifications import clear_doctype_notifications from frappe.desk.notifications import clear_doctype_notifications
from erpnext.buying.utils import validate_for_items, check_for_closed_status from erpnext.buying.utils import validate_for_items, check_for_closed_status
from erpnext.stock.utils import get_bin from erpnext.stock.utils import get_bin
from erpnext.accounts.party import get_party_account_currency
from six import string_types from six import string_types
from erpnext.stock.doctype.item.item import get_item_defaults from erpnext.stock.doctype.item.item import get_item_defaults
from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
@ -87,6 +88,8 @@ class PurchaseOrder(BuyingController):
standing = frappe.db.get_value("Supplier Scorecard",self.supplier, 'status') 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') 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): def validate_minimum_order_qty(self):
items = list(set([d.item_code for d in self.get("items")])) items = list(set([d.item_code for d in self.get("items")]))