mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-04 15:56:34 +00:00
feat: added coupon code functionality onsales invoice
This commit is contained in:
@@ -740,10 +740,10 @@ def validate_coupon_code(coupon_name):
|
||||
if coupon.valid_from:
|
||||
if coupon.valid_from > getdate(today()):
|
||||
frappe.throw(_("Sorry, this coupon code's validity has not started"))
|
||||
if coupon.valid_upto:
|
||||
elif coupon.valid_upto:
|
||||
if coupon.valid_upto < getdate(today()):
|
||||
frappe.throw(_("Sorry, this coupon code's validity has expired"))
|
||||
if coupon.used >= coupon.maximum_use:
|
||||
elif coupon.used >= coupon.maximum_use:
|
||||
frappe.throw(_("Sorry, this coupon code is no longer valid"))
|
||||
|
||||
|
||||
|
||||
@@ -271,6 +271,8 @@ class SalesInvoice(SellingController):
|
||||
validate_inter_company_party(
|
||||
self.doctype, self.customer, self.company, self.inter_company_invoice_reference
|
||||
)
|
||||
|
||||
# Validating coupon code
|
||||
if self.coupon_code:
|
||||
validate_coupon_code(self.coupon_code)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user