mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
fix: loyalty points application on si
(cherry picked from commit 48b5567af4)
This commit is contained in:
@@ -304,17 +304,6 @@ class SalesInvoice(SellingController):
|
|||||||
if not self.is_opening:
|
if not self.is_opening:
|
||||||
self.is_opening = "No"
|
self.is_opening = "No"
|
||||||
|
|
||||||
if self.redeem_loyalty_points:
|
|
||||||
lp = frappe.get_doc("Loyalty Program", self.loyalty_program)
|
|
||||||
self.loyalty_redemption_account = (
|
|
||||||
lp.expense_account if not self.loyalty_redemption_account else self.loyalty_redemption_account
|
|
||||||
)
|
|
||||||
self.loyalty_redemption_cost_center = (
|
|
||||||
lp.cost_center
|
|
||||||
if not self.loyalty_redemption_cost_center
|
|
||||||
else self.loyalty_redemption_cost_center
|
|
||||||
)
|
|
||||||
|
|
||||||
self.set_against_income_account()
|
self.set_against_income_account()
|
||||||
self.validate_time_sheets_are_submitted()
|
self.validate_time_sheets_are_submitted()
|
||||||
self.validate_multiple_billing("Delivery Note", "dn_detail", "amount")
|
self.validate_multiple_billing("Delivery Note", "dn_detail", "amount")
|
||||||
@@ -333,12 +322,7 @@ class SalesInvoice(SellingController):
|
|||||||
if self.is_pos and self.is_return:
|
if self.is_pos and self.is_return:
|
||||||
self.verify_payment_amount_is_negative()
|
self.verify_payment_amount_is_negative()
|
||||||
|
|
||||||
if (
|
if self.redeem_loyalty_points and self.loyalty_points and not self.is_consolidated:
|
||||||
self.redeem_loyalty_points
|
|
||||||
and self.loyalty_program
|
|
||||||
and self.loyalty_points
|
|
||||||
and not self.is_consolidated
|
|
||||||
):
|
|
||||||
validate_loyalty_points(self, self.loyalty_points)
|
validate_loyalty_points(self, self.loyalty_points)
|
||||||
|
|
||||||
self.reset_default_field_value("set_warehouse", "items", "warehouse")
|
self.reset_default_field_value("set_warehouse", "items", "warehouse")
|
||||||
@@ -1438,7 +1422,7 @@ class SalesInvoice(SellingController):
|
|||||||
asset.set_status("Sold" if self.docstatus == 1 else None)
|
asset.set_status("Sold" if self.docstatus == 1 else None)
|
||||||
|
|
||||||
def make_loyalty_point_redemption_gle(self, gl_entries):
|
def make_loyalty_point_redemption_gle(self, gl_entries):
|
||||||
if cint(self.redeem_loyalty_points):
|
if cint(self.redeem_loyalty_points and self.loyalty_points and not self.is_consolidated):
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict(
|
self.get_gl_dict(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1078,6 +1078,7 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
|
|||||||
# set the redeem loyalty points if provided via shopping cart
|
# set the redeem loyalty points if provided via shopping cart
|
||||||
if source.loyalty_points and source.order_type == "Shopping Cart":
|
if source.loyalty_points and source.order_type == "Shopping Cart":
|
||||||
target.redeem_loyalty_points = 1
|
target.redeem_loyalty_points = 1
|
||||||
|
target.loyalty_points = source.loyalty_points
|
||||||
|
|
||||||
target.debit_to = get_party_account("Customer", source.customer, source.company)
|
target.debit_to = get_party_account("Customer", source.customer, source.company)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user