mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 23:49:19 +00:00
fix:payment ammount validation for pos invoices (#18663)
This commit is contained in:
committed by
Nabin Hait
parent
5a7f26f4d2
commit
78690d7b8b
@@ -78,6 +78,7 @@ class SalesInvoice(SellingController):
|
|||||||
self.so_dn_required()
|
self.so_dn_required()
|
||||||
|
|
||||||
self.validate_proj_cust()
|
self.validate_proj_cust()
|
||||||
|
self.validate_pos_return()
|
||||||
self.validate_with_previous_doc()
|
self.validate_with_previous_doc()
|
||||||
self.validate_uom_is_integer("stock_uom", "stock_qty")
|
self.validate_uom_is_integer("stock_uom", "stock_qty")
|
||||||
self.validate_uom_is_integer("uom", "qty")
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
@@ -199,6 +200,16 @@ class SalesInvoice(SellingController):
|
|||||||
if "Healthcare" in active_domains:
|
if "Healthcare" in active_domains:
|
||||||
manage_invoice_submit_cancel(self, "on_submit")
|
manage_invoice_submit_cancel(self, "on_submit")
|
||||||
|
|
||||||
|
def validate_pos_return(self):
|
||||||
|
|
||||||
|
if self.is_pos and self.is_return:
|
||||||
|
total_amount_in_payments = 0
|
||||||
|
for payment in self.payments:
|
||||||
|
total_amount_in_payments += payment.amount
|
||||||
|
|
||||||
|
if total_amount_in_payments < self.rounded_total:
|
||||||
|
frappe.throw(_("Total payments amount can't be greater than {}".format(-self.rounded_total)))
|
||||||
|
|
||||||
def validate_pos_paid_amount(self):
|
def validate_pos_paid_amount(self):
|
||||||
if len(self.payments) == 0 and self.is_pos:
|
if len(self.payments) == 0 and self.is_pos:
|
||||||
frappe.throw(_("At least one mode of payment is required for POS invoice."))
|
frappe.throw(_("At least one mode of payment is required for POS invoice."))
|
||||||
|
|||||||
Reference in New Issue
Block a user