fix: improving ux for additional discount field (#26502)
This commit is contained in:
parent
26a9d38547
commit
9b9b18c286
@ -367,15 +367,16 @@ erpnext.PointOfSale.ItemCart = class {
|
|||||||
`<div class="add-discount-field"></div>`
|
`<div class="add-discount-field"></div>`
|
||||||
);
|
);
|
||||||
const me = this;
|
const me = this;
|
||||||
|
const frm = me.events.get_frm();
|
||||||
|
let discount = frm.doc.additional_discount_percentage;
|
||||||
|
|
||||||
this.discount_field = frappe.ui.form.make_control({
|
this.discount_field = frappe.ui.form.make_control({
|
||||||
df: {
|
df: {
|
||||||
label: __('Discount'),
|
label: __('Discount'),
|
||||||
fieldtype: 'Data',
|
fieldtype: 'Data',
|
||||||
placeholder: __('Enter discount percentage.'),
|
placeholder: ( discount ? discount + '%' : __('Enter discount percentage.') ),
|
||||||
input_class: 'input-xs',
|
input_class: 'input-xs',
|
||||||
onchange: function() {
|
onchange: function() {
|
||||||
const frm = me.events.get_frm();
|
|
||||||
if (flt(this.value) != 0) {
|
if (flt(this.value) != 0) {
|
||||||
frappe.model.set_value(frm.doc.doctype, frm.doc.name, 'additional_discount_percentage', flt(this.value));
|
frappe.model.set_value(frm.doc.doctype, frm.doc.name, 'additional_discount_percentage', flt(this.value));
|
||||||
me.hide_discount_control(this.value);
|
me.hide_discount_control(this.value);
|
||||||
|
Loading…
Reference in New Issue
Block a user