fix: Pricing Rule Discount for Product
This commit is contained in:
parent
1202e64403
commit
2ae79b8ac2
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
"autoname": "field:title",
|
"autoname": "field:title",
|
||||||
@ -390,8 +389,7 @@
|
|||||||
"fieldname": "rate_or_discount",
|
"fieldname": "rate_or_discount",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Rate or Discount",
|
"label": "Rate or Discount",
|
||||||
"options": "\nRate\nDiscount Percentage\nDiscount Amount",
|
"options": "\nRate\nDiscount Percentage\nDiscount Amount"
|
||||||
"reqd": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "Grand Total",
|
"default": "Grand Total",
|
||||||
@ -440,7 +438,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"depends_on": "eval:!doc.mixed_conditions && doc.price_or_product_discount == 'Price'",
|
"depends_on": "eval:!doc.mixed_conditions && doc.apply_on != 'Transaction'",
|
||||||
"fieldname": "same_item",
|
"fieldname": "same_item",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Same Item"
|
"label": "Same Item"
|
||||||
@ -556,8 +554,7 @@
|
|||||||
],
|
],
|
||||||
"icon": "fa fa-gift",
|
"icon": "fa fa-gift",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"links": [],
|
"modified": "2019-12-18 17:29:22.957077",
|
||||||
"modified": "2019-12-13 15:48:48.331495",
|
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Pricing Rule",
|
"name": "Pricing Rule",
|
||||||
|
@ -47,6 +47,9 @@ class PricingRule(Document):
|
|||||||
if tocheck and not self.get(tocheck):
|
if tocheck and not self.get(tocheck):
|
||||||
throw(_("{0} is required").format(self.meta.get_label(tocheck)), frappe.MandatoryError)
|
throw(_("{0} is required").format(self.meta.get_label(tocheck)), frappe.MandatoryError)
|
||||||
|
|
||||||
|
if self.price_or_product_discount == 'Price' and not self.rate_or_discount:
|
||||||
|
throw(_("Rate or Discount is required for the price discount."), frappe.MandatoryError)
|
||||||
|
|
||||||
def validate_applicable_for_selling_or_buying(self):
|
def validate_applicable_for_selling_or_buying(self):
|
||||||
if not self.selling and not self.buying:
|
if not self.selling and not self.buying:
|
||||||
throw(_("Atleast one of the Selling or Buying must be selected"))
|
throw(_("Atleast one of the Selling or Buying must be selected"))
|
||||||
|
@ -500,6 +500,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
() => {
|
() => {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
me.add_taxes_from_item_tax_template(d.item_tax_rate);
|
me.add_taxes_from_item_tax_template(d.item_tax_rate);
|
||||||
|
if (d.free_item_data) {
|
||||||
|
me.apply_product_discount(d.free_item_data);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => me.frm.script_manager.trigger("price_list_rate", cdt, cdn),
|
() => me.frm.script_manager.trigger("price_list_rate", cdt, cdn),
|
||||||
() => me.toggle_conversion_factor(item),
|
() => me.toggle_conversion_factor(item),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user