fix: configuration to accept partial payment in pos invoice (#47052)

This commit is contained in:
Diptanil Saha
2025-04-15 19:03:55 +05:30
committed by GitHub
parent 073a7a6ca6
commit a944853b56
3 changed files with 14 additions and 3 deletions

View File

@@ -497,8 +497,11 @@ class POSInvoice(SalesInvoice):
def validate_full_payment(self): def validate_full_payment(self):
invoice_total = flt(self.rounded_total) or flt(self.grand_total) 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: if self.is_return and self.paid_amount != invoice_total:
frappe.throw( frappe.throw(
msg=_("Partial Payment in POS Invoice is not allowed."), exc=PartialPaymentValidationError msg=_("Partial Payment in POS Invoice is not allowed."), exc=PartialPaymentValidationError

View File

@@ -30,6 +30,7 @@
"allow_rate_change", "allow_rate_change",
"allow_discount_change", "allow_discount_change",
"disable_grand_total_to_default_mop", "disable_grand_total_to_default_mop",
"allow_partial_payment",
"section_break_23", "section_break_23",
"item_groups", "item_groups",
"column_break_25", "column_break_25",
@@ -398,6 +399,12 @@
"oldfieldname": "cost_center", "oldfieldname": "cost_center",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Project" "options": "Project"
},
{
"default": "0",
"fieldname": "allow_partial_payment",
"fieldtype": "Check",
"label": "Allow Partial Payment"
} }
], ],
"icon": "icon-cog", "icon": "icon-cog",
@@ -425,7 +432,7 @@
"link_fieldname": "pos_profile" "link_fieldname": "pos_profile"
} }
], ],
"modified": "2025-04-09 11:35:13.779613", "modified": "2025-04-14 15:58:20.497426",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Profile", "name": "POS Profile",
@@ -455,4 +462,4 @@
"sort_field": "creation", "sort_field": "creation",
"sort_order": "DESC", "sort_order": "DESC",
"states": [] "states": []
} }

View File

@@ -29,6 +29,7 @@ class POSProfile(Document):
account_for_change_amount: DF.Link | None account_for_change_amount: DF.Link | None
allow_discount_change: DF.Check allow_discount_change: DF.Check
allow_partial_payment: DF.Check
allow_rate_change: DF.Check allow_rate_change: DF.Check
applicable_for_users: DF.Table[POSProfileUser] applicable_for_users: DF.Table[POSProfileUser]
apply_discount_on: DF.Literal["Grand Total", "Net Total"] apply_discount_on: DF.Literal["Grand Total", "Net Total"]