fix: partial return on POS invoice

(cherry picked from commit 18bdd06652)

# Conflicts:
#	erpnext/accounts/doctype/pos_invoice/pos_invoice.py
This commit is contained in:
Nihantra C. Patel
2024-09-17 15:35:07 +05:30
committed by Mergify
parent ef7d4fe84a
commit 50e0f56d18

View File

@@ -379,16 +379,21 @@ class POSInvoice(SalesInvoice):
if self.is_return and entry.amount > 0:
frappe.throw(_("Row #{0} (Payment Table): Amount must be negative").format(entry.idx))
if self.is_return:
if self.is_return and self.docstatus != 0:
invoice_total = self.rounded_total or self.grand_total
<<<<<<< HEAD
if total_amount_in_payments and total_amount_in_payments < invoice_total:
frappe.throw(_("Total payments amount can't be greater than {}").format(-invoice_total))
=======
total_amount_in_payments = flt(total_amount_in_payments, self.precision("grand_total"))
<<<<<<< HEAD
if total_amount_in_payments and total_amount_in_payments > invoice_total:
frappe.throw(_("Total payments amount can't be greater than {}").format(invoice_total))
>>>>>>> 76289fa8dc (fix: partial return on POS invoice)
=======
if total_amount_in_payments and total_amount_in_payments < invoice_total:
frappe.throw(_("Total payments amount can't be greater than {}").format(-invoice_total))
>>>>>>> 18bdd06652 (fix: partial return on POS invoice)
def validate_company_with_pos_company(self):
if self.company != frappe.db.get_value("POS Profile", self.pos_profile, "company"):