mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-05 14:38:26 +00:00
fix: configuration to accept partial payment in pos invoice (#47052)
(cherry picked from commit a944853b56)
# Conflicts:
# erpnext/accounts/doctype/pos_invoice/pos_invoice.py
# erpnext/accounts/doctype/pos_profile/pos_profile.json
# erpnext/accounts/doctype/pos_profile/pos_profile.py
This commit is contained in:
@@ -407,6 +407,26 @@ class POSInvoice(SalesInvoice):
|
||||
if self.redeem_loyalty_points and self.loyalty_program and self.loyalty_points:
|
||||
validate_loyalty_points(self, self.loyalty_points)
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
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 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
|
||||
)
|
||||
|
||||
if self.paid_amount < invoice_total:
|
||||
frappe.throw(
|
||||
msg=_("Partial Payment in POS Invoice is not allowed."), exc=PartialPaymentValidationError
|
||||
)
|
||||
|
||||
>>>>>>> a944853b56 (fix: configuration to accept partial payment in pos invoice (#47052))
|
||||
def set_status(self, update=False, status=None, update_modified=True):
|
||||
if self.is_new():
|
||||
if self.get("amended_from"):
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
"ignore_pricing_rule",
|
||||
"allow_rate_change",
|
||||
"allow_discount_change",
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"disable_grand_total_to_default_mop",
|
||||
"allow_partial_payment",
|
||||
>>>>>>> a944853b56 (fix: configuration to accept partial payment in pos invoice (#47052))
|
||||
"section_break_23",
|
||||
"item_groups",
|
||||
"column_break_25",
|
||||
@@ -375,6 +380,35 @@
|
||||
"fieldname": "disable_rounded_total",
|
||||
"fieldtype": "Check",
|
||||
"label": "Disable Rounded Total"
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "print_receipt_on_order_complete",
|
||||
"fieldtype": "Check",
|
||||
"label": "Print Receipt on Order Complete"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "disable_grand_total_to_default_mop",
|
||||
"fieldtype": "Check",
|
||||
"label": "Disable auto setting Grand Total to default Payment Mode"
|
||||
},
|
||||
{
|
||||
"fieldname": "project",
|
||||
"fieldtype": "Link",
|
||||
"label": "Project",
|
||||
"oldfieldname": "cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Project"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "allow_partial_payment",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Partial Payment"
|
||||
>>>>>>> a944853b56 (fix: configuration to accept partial payment in pos invoice (#47052))
|
||||
}
|
||||
],
|
||||
"icon": "icon-cog",
|
||||
@@ -402,7 +436,11 @@
|
||||
"link_fieldname": "pos_profile"
|
||||
}
|
||||
],
|
||||
<<<<<<< HEAD
|
||||
"modified": "2022-08-10 12:57:06.241439",
|
||||
=======
|
||||
"modified": "2025-04-14 15:58:20.497426",
|
||||
>>>>>>> a944853b56 (fix: configuration to accept partial payment in pos invoice (#47052))
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Profile",
|
||||
|
||||
@@ -9,6 +9,64 @@ from frappe.utils import get_link_to_form, now
|
||||
|
||||
|
||||
class POSProfile(Document):
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
from erpnext.accounts.doctype.pos_customer_group.pos_customer_group import POSCustomerGroup
|
||||
from erpnext.accounts.doctype.pos_item_group.pos_item_group import POSItemGroup
|
||||
from erpnext.accounts.doctype.pos_payment_method.pos_payment_method import POSPaymentMethod
|
||||
from erpnext.accounts.doctype.pos_profile_user.pos_profile_user import POSProfileUser
|
||||
|
||||
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"]
|
||||
auto_add_item_to_cart: DF.Check
|
||||
campaign: DF.Link | None
|
||||
company: DF.Link
|
||||
company_address: DF.Link | None
|
||||
cost_center: DF.Link | None
|
||||
country: DF.ReadOnly | None
|
||||
currency: DF.Link
|
||||
customer: DF.Link | None
|
||||
customer_groups: DF.Table[POSCustomerGroup]
|
||||
disable_grand_total_to_default_mop: DF.Check
|
||||
disable_rounded_total: DF.Check
|
||||
disabled: DF.Check
|
||||
expense_account: DF.Link | None
|
||||
hide_images: DF.Check
|
||||
hide_unavailable_items: DF.Check
|
||||
ignore_pricing_rule: DF.Check
|
||||
income_account: DF.Link | None
|
||||
item_groups: DF.Table[POSItemGroup]
|
||||
letter_head: DF.Link | None
|
||||
payments: DF.Table[POSPaymentMethod]
|
||||
print_format: DF.Link | None
|
||||
print_receipt_on_order_complete: DF.Check
|
||||
project: DF.Link | None
|
||||
select_print_heading: DF.Link | None
|
||||
selling_price_list: DF.Link | None
|
||||
tax_category: DF.Link | None
|
||||
taxes_and_charges: DF.Link | None
|
||||
tc_name: DF.Link | None
|
||||
update_stock: DF.Check
|
||||
validate_stock_on_save: DF.Check
|
||||
warehouse: DF.Link
|
||||
write_off_account: DF.Link
|
||||
write_off_cost_center: DF.Link
|
||||
write_off_limit: DF.Currency
|
||||
# end: auto-generated types
|
||||
|
||||
>>>>>>> a944853b56 (fix: configuration to accept partial payment in pos invoice (#47052))
|
||||
def validate(self):
|
||||
self.validate_default_profile()
|
||||
self.validate_all_link_fields()
|
||||
|
||||
Reference in New Issue
Block a user