Merge pull request #19061 from rohitwaghchaure/user_can_edit_rate_and_discount_in_offline_pos_develop
fix: user can able to change rate and discount even if they don't have permissions
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 0cd8bfe..ff0c265 100755
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -1624,7 +1624,7 @@
setTimeout(function () {
w.print();
w.close();
- }, 1000)
+ }, 1000);
},
submit_invoice: function () {
@@ -1681,6 +1681,12 @@
$(this.wrapper).find('.pos-bill').css('pointer-events', pointer_events);
$(this.wrapper).find('.pos-items-section').css('pointer-events', pointer_events);
this.set_primary_action();
+
+ $(this.wrapper).find('#pos-item-disc').prop('disabled',
+ this.pos_profile_data.allow_user_to_edit_discount ? false : true);
+
+ $(this.wrapper).find('#pos-item-price').prop('disabled',
+ this.pos_profile_data.allow_user_to_edit_rate ? false : true);
},
create_invoice: function () {
@@ -1891,7 +1897,7 @@
serial_no = me.item_serial_no[key][0];
}
- if (this.items[0].has_serial_no && serial_no == "") {
+ if (this.items && this.items[0].has_serial_no && serial_no == "") {
this.refresh();
frappe.throw(__(repl("Error: Serial no is mandatory for item %(item)s", {
'item': this.items[0].item_code