feat: add recursion qty field in promotional scheme
This commit is contained in:
@@ -60,6 +60,8 @@ product_discount_fields = [
|
|||||||
"free_item_rate",
|
"free_item_rate",
|
||||||
"same_item",
|
"same_item",
|
||||||
"is_recursive",
|
"is_recursive",
|
||||||
|
"recurse_for",
|
||||||
|
"apply_recursion_over",
|
||||||
"apply_multiple_pricing_rules",
|
"apply_multiple_pricing_rules",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,9 @@
|
|||||||
"threshold_percentage",
|
"threshold_percentage",
|
||||||
"column_break_15",
|
"column_break_15",
|
||||||
"priority",
|
"priority",
|
||||||
"is_recursive"
|
"is_recursive",
|
||||||
|
"recurse_for",
|
||||||
|
"apply_recursion_over"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -161,17 +163,36 @@
|
|||||||
"fieldname": "is_recursive",
|
"fieldname": "is_recursive",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Is Recursive"
|
"label": "Is Recursive"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"depends_on": "is_recursive",
|
||||||
|
"description": "Give free item for every N quantity",
|
||||||
|
"fieldname": "recurse_for",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"label": "Recurse Every (As Per Transaction UOM)",
|
||||||
|
"mandatory_depends_on": "is_recursive"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"depends_on": "is_recursive",
|
||||||
|
"description": "Qty for which recursion isn't applicable.",
|
||||||
|
"fieldname": "apply_recursion_over",
|
||||||
|
"fieldtype": "Float",
|
||||||
|
"label": "Apply Recursion Over (As Per Transaction UOM)",
|
||||||
|
"mandatory_depends_on": "is_recursive"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-03-06 21:58:18.162346",
|
"modified": "2024-03-12 12:53:58.199108",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Promotional Scheme Product Discount",
|
"name": "Promotional Scheme Product Discount",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC"
|
"sort_order": "DESC",
|
||||||
|
"states": []
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@ class PromotionalSchemeProductDiscount(Document):
|
|||||||
from frappe.types import DF
|
from frappe.types import DF
|
||||||
|
|
||||||
apply_multiple_pricing_rules: DF.Check
|
apply_multiple_pricing_rules: DF.Check
|
||||||
|
apply_recursion_over: DF.Float
|
||||||
disable: DF.Check
|
disable: DF.Check
|
||||||
free_item: DF.Link | None
|
free_item: DF.Link | None
|
||||||
free_item_rate: DF.Currency
|
free_item_rate: DF.Currency
|
||||||
@@ -51,6 +52,7 @@ class PromotionalSchemeProductDiscount(Document):
|
|||||||
"19",
|
"19",
|
||||||
"20",
|
"20",
|
||||||
]
|
]
|
||||||
|
recurse_for: DF.Float
|
||||||
rule_description: DF.SmallText
|
rule_description: DF.SmallText
|
||||||
same_item: DF.Check
|
same_item: DF.Check
|
||||||
threshold_percentage: DF.Percent
|
threshold_percentage: DF.Percent
|
||||||
|
|||||||
@@ -1813,8 +1813,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
let items = [];
|
let items = [];
|
||||||
|
|
||||||
me.frm.doc.items.forEach(d => {
|
me.frm.doc.items.forEach(d => {
|
||||||
// if same item was added a free item through a different pricing rule, keep it
|
// if same item was added as free item through a different pricing rule, keep it
|
||||||
if(d.item_code != item.remove_free_item || !d.is_free_item || removed_pricing_rule?.includes(d.pricing_rules)) {
|
if(d.item_code != item.remove_free_item || !d.is_free_item || !removed_pricing_rule?.includes(d.pricing_rules)) {
|
||||||
items.push(d);
|
items.push(d);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user