From ef7d4fe84adc17ed12b1b1d42c47b3d04a64231f Mon Sep 17 00:00:00 2001 From: "Nihantra C. Patel" <141945075+Nihantra-Patel@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:51:26 +0530 Subject: [PATCH 1/3] fix: partial return on POS invoice (cherry picked from commit 76289fa8dcf3ee670d9c6976e4d53e7ce230cb6c) # Conflicts: # erpnext/accounts/doctype/pos_invoice/pos_invoice.py --- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 4abe91680e8..4033db97b82 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -381,8 +381,14 @@ class POSInvoice(SalesInvoice): if self.is_return: 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")) + 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) def validate_company_with_pos_company(self): if self.company != frappe.db.get_value("POS Profile", self.pos_profile, "company"): From 50e0f56d18253b3cf1f7889f1d3896ede1223a91 Mon Sep 17 00:00:00 2001 From: "Nihantra C. Patel" <141945075+Nihantra-Patel@users.noreply.github.com> Date: Tue, 17 Sep 2024 15:35:07 +0530 Subject: [PATCH 2/3] fix: partial return on POS invoice (cherry picked from commit 18bdd06652ff3cc772214fa7c6ed620554eddbb7) # Conflicts: # erpnext/accounts/doctype/pos_invoice/pos_invoice.py --- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 4033db97b82..899b9aa8f0c 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -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"): From 5ce4dae204cedb0e9f74b8820ae3250abf770ab2 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 23 Sep 2024 20:02:10 +0530 Subject: [PATCH 3/3] chore: resolve conflict --- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 899b9aa8f0c..80c4db50acb 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -381,19 +381,8 @@ class POSInvoice(SalesInvoice): 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"):