2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 14:50:56 +00:00

feat: pricing rule schemas

This commit is contained in:
akshayitzme 2024-01-30 18:24:01 +05:30
parent 7205f5aa42
commit e1524afb44
7 changed files with 331 additions and 1 deletions

View File

@ -107,6 +107,13 @@
"default": false,
"section": "Features"
},
{
"fieldname": "enablePricingRule",
"label": "Enable Pricing Rule",
"fieldtype": "Check",
"default": false,
"section": "Features"
},
{
"fieldname": "fiscalYearStart",
"label": "Fiscal Year Start Date",

View File

@ -62,6 +62,10 @@
{
"value": "PurchaseReceipt",
"label": "Purchase Receipt"
},
{
"value": "PricingRule",
"label": "Pricing Rule"
}
],
"default": "-",

View File

@ -0,0 +1,242 @@
{
"name": "PricingRule",
"label": "Pricing Rule",
"naming": "numberSeries",
"isSubmittable": false,
"fields": [
{
"fieldname": "numberSeries",
"label": "Number Series",
"fieldtype": "Link",
"target": "NumberSeries",
"create": true,
"required": true,
"default": "PRLE-",
"section": "Default"
},
{
"fieldname": "isEnabled",
"label": "Is Pricing Rule Enabled",
"fieldtype": "Check",
"default": true,
"section": "Default"
},
{
"fieldname": "title",
"label": "Title",
"fieldtype": "Data",
"required": true,
"section": "Default"
},
{
"fieldname": "appliedItems",
"label": "Applied Items",
"fieldtype": "Table",
"target": "PricingRuleItem",
"required": true,
"edit": true,
"section": "Items"
},
{
"fieldname": "discountType",
"label": "Discount Type",
"fieldtype": "Select",
"required": true,
"section": "Default",
"options": [
{
"value": "Price Discount",
"label": "Price Discount"
},
{
"value": "Product Discount",
"label": "Product Discount"
}
]
},
{
"fieldname": "priceDiscountType",
"label": "Price Discount Type",
"fieldtype": "Select",
"section": "Price Discount Scheme",
"options": [
{
"value": "rate",
"label": "Rate"
},
{
"value": "percentage",
"label": "Discount Percentage"
},
{
"value": "amount",
"label": "Discount Amount"
}
]
},
{
"fieldname": "discountRate",
"label": "Rate",
"fieldtype": "Currency",
"section": "Price Discount Scheme"
},
{
"fieldname": "discountPercentage",
"label": "Discount Percentage",
"fieldtype": "Float",
"section": "Price Discount Scheme"
},
{
"fieldname": "discountAmount",
"label": "Discount Amount",
"fieldtype": "Currency",
"section": "Price Discount Scheme"
},
{
"fieldname": "forPriceList",
"label": "For Price List",
"fieldtype": "Link",
"target": "PriceList",
"section": "Price Discount Scheme"
},
{
"fieldname": "freeItem",
"label": "Free Item",
"fieldtype": "Link",
"target": "Item",
"section": "Product Discount Scheme"
},
{
"fieldname": "freeItemQuantity",
"label": "Quantity",
"fieldtype": "Float",
"section": "Product Discount Scheme"
},
{
"fieldname": "freeItemUnit",
"label": "UOM",
"fieldtype": "Link",
"target": "UOM",
"section": "Product Discount Scheme"
},
{
"fieldname": "freeItemRate",
"label": "Rate",
"fieldtype": "Currency",
"section": "Product Discount Scheme"
},
{
"fieldname": "roundFreeItemQty",
"label": "Round Free Item Quantity",
"fieldtype": "Check",
"default": false,
"section": "Product Discount Scheme"
},
{
"fieldname": "roundingMethod",
"label": "Rounding Method",
"fieldtype": "Select",
"required": true,
"default": "round",
"section": "Product Discount Scheme",
"options": [
{
"value": "floor",
"label": "Floor"
},
{
"value": "round",
"label": "Round"
},
{
"value": "ceil",
"label": "Ceil"
}
]
},
{
"fieldname": "isRecursive",
"label": "Is Recursive",
"fieldtype": "Check",
"default": false,
"section": "Product Discount Scheme"
},
{
"fieldname": "recurseEvery",
"label": "Recurse Every (As Per Transaction UOM)",
"fieldtype": "Float",
"section": "Product Discount Scheme"
},
{
"fieldname": "minQuantity",
"label": "Min Qty (As Per Stock Unit)",
"fieldtype": "Float",
"section": "Quantity and Amount"
},
{
"fieldname": "maxQuantity",
"label": "Max Qty (As Per Stock UOM)",
"fieldtype": "Float",
"section": "Quantity and Amount"
},
{
"fieldname": "minAmount",
"label": "Min Amount",
"fieldtype": "Currency",
"section": "Quantity and Amount"
},
{
"fieldname": "maxAmount",
"label": "Max Amount",
"fieldtype": "Currency",
"section": "Quantity and Amount"
},
{
"fieldname": "validFrom",
"label": "Valid From",
"fieldtype": "Date",
"section": "Validity"
},
{
"fieldname": "validTo",
"label": "Valid To",
"fieldtype": "Date",
"section": "Validity"
},
{
"fieldname": "thresholdForSuggestion",
"label": "Threshold for Suggestion",
"fieldtype": "Float",
"section": "Threshold and Priority"
},
{
"fieldname": "priority",
"label": "Priority",
"fieldtype": "Select",
"section": "Threshold and Priority",
"required": true,
"options": [
{ "value": "1", "label": 1 },
{ "value": "2", "label": 2 },
{ "value": "3", "label": 3 },
{ "value": "4", "label": 4 },
{ "value": "5", "label": 5 },
{ "value": "6", "label": 6 },
{ "value": "7", "label": 7 },
{ "value": "8", "label": 8 },
{ "value": "9", "label": 9 },
{ "value": "10", "label": 10 },
{ "value": "11", "label": 11 },
{ "value": "12", "label": 12 },
{ "value": "13", "label": 13 },
{ "value": "14", "label": 14 },
{ "value": "15", "label": 15 },
{ "value": "16", "label": 16 },
{ "value": "17", "label": 17 },
{ "value": "18", "label": 18 },
{ "value": "19", "label": 19 },
{ "value": "20", "label": 20 }
]
}
]
}

View File

@ -0,0 +1,23 @@
{
"name": "PricingRuleDetail",
"label": "Pricing Rule Detail",
"isSingle": false,
"isChild": true,
"fields": [
{
"label": "Pricing Rule",
"fieldname": "referenceName",
"fieldtype": "Link",
"target": "PricingRule",
"readOnly": true
},
{
"label": "Item",
"fieldname": "referenceItem",
"fieldtype": "Link",
"target": "Item",
"readOnly": true
}
],
"tableFields": ["referenceName", "referenceItem"]
}

View File

@ -0,0 +1,25 @@
{
"name": "PricingRuleItem",
"label": "Pricing Rule Item",
"isChild": true,
"fields": [
{
"fieldname": "item",
"label": "Item",
"fieldtype": "Link",
"target": "Item",
"required": true
},
{
"fieldname": "unit",
"label": "Unit Type",
"placeholder": "Unit Type",
"fieldtype": "Link",
"target": "UOM",
"create": true,
"section": "Default"
}
],
"tableFields": ["item", "unit"],
"quickEditFields": ["item", "unit"]
}

View File

@ -75,6 +75,21 @@
"fieldtype": "Check",
"default": false,
"hidden": true
},
{
"fieldname": "isPricingRuleApplied",
"fieldtype": "Check",
"default": false,
"hidden": true
},
{
"fieldname": "pricingRuleDetail",
"fieldtype": "Table",
"label": "Pricing Rule Detail",
"target": "PricingRuleDetail",
"edit": false,
"readOnly": true,
"section": "References"
}
],
"keywordFields": ["name", "party"]

View File

@ -1,5 +1,19 @@
{
"name": "SalesInvoiceItem",
"label": "Sales Invoice Item",
"extends": "InvoiceItem"
"extends": "InvoiceItem",
"fields": [
{
"fieldname": "isFreeItem",
"fieldtype": "Check",
"default": false,
"hidden": true
},
{
"fieldname": "isPricingRuleAppliedItem",
"fieldtype": "Check",
"default": false,
"hidden": true
}
]
}