Revert "fix: Item Price using batch selector"

This reverts commit 34c58529d9.
This commit is contained in:
Deepesh Garg
2021-01-15 10:10:54 +05:30
parent f68e85519c
commit 2c12124550
4 changed files with 17 additions and 11 deletions

View File

@@ -195,6 +195,10 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
this._super(doc, cdt, cdn); this._super(doc, cdt, cdn);
}, },
batch_no: function(doc, cdt, cdn) {
this._super(doc, cdt, cdn);
},
received_qty: function(doc, cdt, cdn) { received_qty: function(doc, cdt, cdn) {
this.calculate_accepted_qty(doc, cdt, cdn) this.calculate_accepted_qty(doc, cdt, cdn)
}, },

View File

@@ -1124,6 +1124,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
} }
}, },
batch_no: function(doc, cdt, cdn) {
let item = frappe.get_doc(cdt, cdn);
this.apply_price_list(item, true);
},
toggle_conversion_factor: function(item) { toggle_conversion_factor: function(item) {
// toggle read only property for conversion factor field if the uom and stock uom are same // toggle read only property for conversion factor field if the uom and stock uom are same
if(this.frm.get_field('items').grid.fields_map.conversion_factor) { if(this.frm.get_field('items').grid.fields_map.conversion_factor) {
@@ -1540,9 +1545,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
return; return;
} }
let for_batch = (item && item.batch_no) ? true : false; if (me.in_apply_price_list == true) return;
if (me.in_apply_price_list == true && (!for_batch)) return;
me.in_apply_price_list = true; me.in_apply_price_list = true;
return this.frm.call({ return this.frm.call({

View File

@@ -220,7 +220,6 @@ erpnext.SerialNoBatchSelector = Class.extend({
if (i !== 0 && !this.batch_exists(batch_no)) { if (i !== 0 && !this.batch_exists(batch_no)) {
row = this.frm.add_child("items", { ...this.item }); row = this.frm.add_child("items", { ...this.item });
frappe.model.set_value(row.doctype, row.name, 'batch_no', batch_no);
} else { } else {
row = this.frm.doc.items.find(i => i.batch_no === batch_no); row = this.frm.doc.items.find(i => i.batch_no === batch_no);
} }
@@ -337,8 +336,6 @@ erpnext.SerialNoBatchSelector = Class.extend({
}, },
change: function () { change: function () {
const batch_no = this.get_value(); const batch_no = this.get_value();
let val = this.get_value();
if (!batch_no) { if (!batch_no) {
this.grid_row.on_grid_fields_dict this.grid_row.on_grid_fields_dict
.available_qty.set_value(0); .available_qty.set_value(0);

View File

@@ -326,8 +326,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
}); });
} }
}) })
me.apply_price_list(item, true);
}, },
set_dynamic_labels: function() { set_dynamic_labels: function() {
@@ -401,6 +399,10 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
} }
}, },
batch_no: function(doc, cdt, cdn) {
this._super(doc, cdt, cdn);
},
qty: function(doc, cdt, cdn) { qty: function(doc, cdt, cdn) {
this._super(doc, cdt, cdn); this._super(doc, cdt, cdn);