mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-09 23:39:28 +00:00
Co-authored-by: Vishnu Priya Baskaran <145791817+ervishnucs@users.noreply.github.com>
This commit is contained in:
@@ -1877,7 +1877,7 @@ class SalesInvoice(SellingController):
|
|||||||
|
|
||||||
for payment_mode in self.payments:
|
for payment_mode in self.payments:
|
||||||
if skip_change_gl_entries and payment_mode.account == self.account_for_change_amount:
|
if skip_change_gl_entries and payment_mode.account == self.account_for_change_amount:
|
||||||
payment_mode.base_amount -= flt(self.change_amount)
|
payment_mode.base_amount -= flt(self.base_change_amount)
|
||||||
|
|
||||||
against_voucher = self.name
|
against_voucher = self.name
|
||||||
if self.is_return and self.return_against and not self.update_outstanding_for_self:
|
if self.is_return and self.return_against and not self.update_outstanding_for_self:
|
||||||
|
|||||||
@@ -1484,6 +1484,33 @@ class TestSalesInvoice(ERPNextTestSuite):
|
|||||||
|
|
||||||
frappe.db.set_single_value("POS Settings", "post_change_gl_entries", 1)
|
frappe.db.set_single_value("POS Settings", "post_change_gl_entries", 1)
|
||||||
|
|
||||||
|
def test_pos_change_amount_multi_currency_gl_entry(self):
|
||||||
|
frappe.db.set_single_value("POS Settings", "post_change_gl_entries", 0)
|
||||||
|
|
||||||
|
si = create_sales_invoice(do_not_save=True)
|
||||||
|
si.is_pos = 1
|
||||||
|
si.currency = "USD"
|
||||||
|
si.conversion_rate = 50
|
||||||
|
si.party_account_currency = "USD"
|
||||||
|
si.account_for_change_amount = "Cash - _TC"
|
||||||
|
si.change_amount = 50
|
||||||
|
si.base_change_amount = 2500
|
||||||
|
si.append(
|
||||||
|
"payments",
|
||||||
|
{"mode_of_payment": "Cash", "account": "Cash - _TC", "amount": 150, "base_amount": 7500},
|
||||||
|
)
|
||||||
|
|
||||||
|
gl_entries = []
|
||||||
|
si.make_pos_gl_entries(gl_entries)
|
||||||
|
|
||||||
|
debtors_entry = next(entry for entry in gl_entries if entry["account"] == si.debit_to)
|
||||||
|
cash_entry = next(entry for entry in gl_entries if entry["account"] == "Cash - _TC")
|
||||||
|
|
||||||
|
self.assertEqual(flt(debtors_entry["credit"]), 5000.0)
|
||||||
|
self.assertEqual(flt(cash_entry["debit"]), 5000.0)
|
||||||
|
|
||||||
|
frappe.db.set_single_value("POS Settings", "post_change_gl_entries", 1)
|
||||||
|
|
||||||
def validate_pos_gl_entry(self, si, pos, cash_amount, validate_without_change_gle=False):
|
def validate_pos_gl_entry(self, si, pos, cash_amount, validate_without_change_gle=False):
|
||||||
if validate_without_change_gle:
|
if validate_without_change_gle:
|
||||||
cash_amount -= pos.change_amount
|
cash_amount -= pos.change_amount
|
||||||
|
|||||||
Reference in New Issue
Block a user