Merge pull request #36899 from ruthra-kumar/use_own_exchange_rate_on_references
fix: difference amount calculation logic in Payment Entry UI
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index 8b929bf..5d3d4d7 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -287,7 +287,7 @@
conditions = ""
for opts in (
- ("company", " and company=%(company)s"),
+ ("company", " and `tabPurchase Invoice`.company=%(company)s"),
("supplier", " and `tabPurchase Invoice`.supplier = %(supplier)s"),
("item_code", " and `tabPurchase Invoice Item`.item_code = %(item_code)s"),
("from_date", " and `tabPurchase Invoice`.posting_date>=%(from_date)s"),
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index 1e7ac33..ce22d75 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -332,7 +332,7 @@
conditions = ""
for opts in (
- ("company", " and company=%(company)s"),
+ ("company", " and `tabSales Invoice`.company=%(company)s"),
("customer", " and `tabSales Invoice`.customer = %(customer)s"),
("item_code", " and `tabSales Invoice Item`.item_code = %(item_code)s"),
("from_date", " and `tabSales Invoice`.posting_date>=%(from_date)s"),
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 1d50639..bfaf6bb 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -1381,7 +1381,7 @@
{
"account": self.additional_discount_account,
"against": supplier_or_customer,
- dr_or_cr: self.discount_amount,
+ dr_or_cr: self.base_discount_amount,
"cost_center": self.cost_center,
},
item=self,
@@ -1653,6 +1653,7 @@
and party_account_currency != self.company_currency
and self.currency != party_account_currency
):
+
frappe.throw(
_("Accounting Entry for {0}: {1} can only be made in currency: {2}").format(
party_type, party, party_account_currency