[go: up one dir, main page]

Skip to content

fix(sales): Ensure markup_percentage is strictly in range 0-100% [backport/v4]

Backport of !1160 (merged)

Conflicts detected for source commit: 9c7e3ed1d6ea5027f3a66cd99d86233ff30b8b04
diff --cc erpnext/public/js/utils/sales_common.js
index 7e636d7ba4,0a4006ebe9..0000000000
--- a/erpnext/public/js/utils/sales_common.js
+++ b/erpnext/public/js/utils/sales_common.js
@@@ -460,7 -460,7 +460,11 @@@ erpnext.sales_common = 
  			}
  
  			gross_profit_percentage(doc, cdt, cdn) {
++<<<<<<< HEAD
 +				if (this.frm.fields_dict["items"].grid.fields_map["gross_profit_percentage"].read_only) {
++=======
+ 				if (this.frm.fields_dict["items"]?.grid.fields_map["gross_profit_percentage"]?.read_only) {
++>>>>>>> 9c7e3ed1d6ea5027f3a66cd99d86233ff30b8b04
  					return
  				}
  
@@@ -480,13 -480,13 +484,22 @@@
  			}
  
  			markup_percentage(doc, cdt, cdn) {
++<<<<<<< HEAD
 +				if (this.frm.fields_dict["items"].grid.fields_map["markup_percentage"].read_only) {
 +					return
++=======
+ 				if (this.frm.fields_dict["items"]?.grid.fields_map["markup_percentage"]?.read_only) {
+ 					return;
++>>>>>>> 9c7e3ed1d6ea5027f3a66cd99d86233ff30b8b04
  				}
  
  				if (["Sales Order", "Quotation"].includes(this.frm.doc.doctype)) {
  					const item = locals[cdt][cdn];
++<<<<<<< HEAD
 +					if (item.markup_percentage && item.gross_profit_calculation_rule && !erpnext.selling.do_not_update_rate) {
++=======
+ 					if (item.unit_cost_price && item.markup_percentage > 0 && item.markup_percentage < 100 && item.gross_profit_calculation_rule && !erpnext.selling.do_not_update_rate) {
++>>>>>>> 9c7e3ed1d6ea5027f3a66cd99d86233ff30b8b04
  						const rate = item.unit_cost_price / (100 - item.markup_percentage) * 100
  
  						if (flt(item.rate, precision("rate", item)) != flt(rate, precision("rate", item))) {

Merge request reports

Loading