From a944853b56a7985a6553500c3dcebec344a2d9bf Mon Sep 17 00:00:00 2001 From: Diptanil Saha Date: Tue, 15 Apr 2025 19:03:55 +0530 Subject: [PATCH] fix: configuration to accept partial payment in pos invoice (#47052) --- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 5 ++++- erpnext/accounts/doctype/pos_profile/pos_profile.json | 11 +++++++++-- erpnext/accounts/doctype/pos_profile/pos_profile.py | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 6933b04d2e1..58c14a2bc5d 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -497,8 +497,11 @@ class POSInvoice(SalesInvoice): def validate_full_payment(self): invoice_total = flt(self.rounded_total) or flt(self.grand_total) + is_partial_payment_allowed = frappe.db.get_value( + "POS Profile", self.pos_profile, "allow_partial_payment" + ) - if self.docstatus == 1: + if self.docstatus == 1 and not is_partial_payment_allowed: if self.is_return and self.paid_amount != invoice_total: frappe.throw( msg=_("Partial Payment in POS Invoice is not allowed."), exc=PartialPaymentValidationError diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json index e74fd72d9e5..9ed39322f4f 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.json +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json @@ -30,6 +30,7 @@ "allow_rate_change", "allow_discount_change", "disable_grand_total_to_default_mop", + "allow_partial_payment", "section_break_23", "item_groups", "column_break_25", @@ -398,6 +399,12 @@ "oldfieldname": "cost_center", "oldfieldtype": "Link", "options": "Project" + }, + { + "default": "0", + "fieldname": "allow_partial_payment", + "fieldtype": "Check", + "label": "Allow Partial Payment" } ], "icon": "icon-cog", @@ -425,7 +432,7 @@ "link_fieldname": "pos_profile" } ], - "modified": "2025-04-09 11:35:13.779613", + "modified": "2025-04-14 15:58:20.497426", "modified_by": "Administrator", "module": "Accounts", "name": "POS Profile", @@ -455,4 +462,4 @@ "sort_field": "creation", "sort_order": "DESC", "states": [] -} +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py index c8049c25d07..143407eb750 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py @@ -29,6 +29,7 @@ class POSProfile(Document): account_for_change_amount: DF.Link | None allow_discount_change: DF.Check + allow_partial_payment: DF.Check allow_rate_change: DF.Check applicable_for_users: DF.Table[POSProfileUser] apply_discount_on: DF.Literal["Grand Total", "Net Total"]