mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
Merge pull request #45530 from frappe/mergify/bp/version-15-hotfix/pr-45284
fix: set party_account_currency for pos_invoice returns (backport #45284)
This commit is contained in:
@@ -4245,6 +4245,30 @@ class TestSalesInvoice(FrappeTestCase):
|
|||||||
doc = frappe.get_doc("Project", project.name)
|
doc = frappe.get_doc("Project", project.name)
|
||||||
self.assertEqual(doc.total_billed_amount, si.grand_total)
|
self.assertEqual(doc.total_billed_amount, si.grand_total)
|
||||||
|
|
||||||
|
def test_pos_returns_with_party_account_currency(self):
|
||||||
|
from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_sales_return
|
||||||
|
|
||||||
|
pos_profile = make_pos_profile()
|
||||||
|
pos_profile.payments = []
|
||||||
|
pos_profile.append("payments", {"default": 1, "mode_of_payment": "Cash"})
|
||||||
|
pos_profile.save()
|
||||||
|
|
||||||
|
pos = create_sales_invoice(
|
||||||
|
customer="_Test Customer USD",
|
||||||
|
currency="USD",
|
||||||
|
conversion_rate=86.595000000,
|
||||||
|
qty=2,
|
||||||
|
do_not_save=True,
|
||||||
|
)
|
||||||
|
pos.is_pos = 1
|
||||||
|
pos.pos_profile = pos_profile.name
|
||||||
|
pos.debit_to = "_Test Receivable USD - _TC"
|
||||||
|
pos.append("payments", {"mode_of_payment": "Cash", "account": "_Test Bank - _TC", "amount": 20.35})
|
||||||
|
pos.save().submit()
|
||||||
|
|
||||||
|
pos_return = make_sales_return(pos.name)
|
||||||
|
self.assertEqual(abs(pos_return.payments[0].amount), pos.payments[0].amount)
|
||||||
|
|
||||||
|
|
||||||
def set_advance_flag(company, flag, default_account):
|
def set_advance_flag(company, flag, default_account):
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
|
|||||||
@@ -370,6 +370,8 @@ def make_return_doc(doctype: str, source_name: str, target_doc=None, return_agai
|
|||||||
if doc.get("is_return"):
|
if doc.get("is_return"):
|
||||||
if doc.doctype == "Sales Invoice" or doc.doctype == "POS Invoice":
|
if doc.doctype == "Sales Invoice" or doc.doctype == "POS Invoice":
|
||||||
doc.consolidated_invoice = ""
|
doc.consolidated_invoice = ""
|
||||||
|
# no copy enabled for party_account_currency
|
||||||
|
doc.party_account_currency = source.party_account_currency
|
||||||
doc.set("payments", [])
|
doc.set("payments", [])
|
||||||
doc.update_billed_amount_in_delivery_note = True
|
doc.update_billed_amount_in_delivery_note = True
|
||||||
for data in source.payments:
|
for data in source.payments:
|
||||||
|
|||||||
Reference in New Issue
Block a user