fix: serial and batch selector and added deprecated decorator
This commit is contained in:
parent
440510337c
commit
c1132d1e6d
@ -363,9 +363,10 @@ erpnext.buying.BuyingController = class BuyingController extends erpnext.Transac
|
||||
new erpnext.SerialBatchPackageSelector(
|
||||
me.frm, item, (r) => {
|
||||
if (r) {
|
||||
me.frm.refresh_fields();
|
||||
frappe.model.set_value(cdt, cdn,
|
||||
"serial_and_batch_bundle", r.name);
|
||||
frappe.model.set_value(item.doctype, item.name, {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"qty": Math.abs(r.total_qty)
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -391,9 +392,10 @@ erpnext.buying.BuyingController = class BuyingController extends erpnext.Transac
|
||||
new erpnext.SerialBatchPackageSelector(
|
||||
me.frm, item, (r) => {
|
||||
if (r) {
|
||||
me.frm.refresh_fields();
|
||||
frappe.model.set_value(cdt, cdn,
|
||||
"rejected_serial_and_batch_bundle", r.name);
|
||||
frappe.model.set_value(item.doctype, item.name, {
|
||||
"rejected_serial_and_batch_bundle": r.name,
|
||||
"rejected_qty": Math.abs(r.total_qty)
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -2329,9 +2329,10 @@ erpnext.show_serial_batch_selector = function (frm, item_row, callback, on_close
|
||||
|
||||
new erpnext.SerialBatchPackageSelector(frm, item_row, (r) => {
|
||||
if (r) {
|
||||
frm.refresh_fields();
|
||||
frappe.model.set_value(item_row.doctype, item_row.name,
|
||||
"serial_and_batch_bundle", r.name);
|
||||
frappe.model.set_value(item_row.doctype, item_row.name, {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"qty": Math.abs(r.total_qty)
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -226,7 +226,6 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate {
|
||||
based_on: based_on
|
||||
},
|
||||
callback: (r) => {
|
||||
debugger
|
||||
if (r.message) {
|
||||
this.dialog.fields_dict.entries.df.data = r.message;
|
||||
this.dialog.fields_dict.entries.grid.refresh();
|
||||
@ -271,6 +270,7 @@ erpnext.SerialBatchPackageSelector = class SerialNoBatchBundleUpdate {
|
||||
}
|
||||
}).then(r => {
|
||||
this.callback && this.callback(r.message);
|
||||
this.frm.save();
|
||||
this.dialog.hide();
|
||||
})
|
||||
}
|
||||
|
@ -384,9 +384,10 @@ erpnext.PointOfSale.ItemDetails = class {
|
||||
|
||||
new erpnext.SerialBatchPackageSelector(frm, item_row, (r) => {
|
||||
if (r) {
|
||||
frm.refresh_fields();
|
||||
frappe.model.set_value(item_row.doctype, item_row.name,
|
||||
"serial_and_batch_bundle", r.name);
|
||||
frappe.model.set_value(item_row.doctype, item_row.name, {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"qty": Math.abs(r.total_qty)
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -444,11 +444,10 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
|
||||
new erpnext.SerialBatchPackageSelector(
|
||||
me.frm, item, (r) => {
|
||||
if (r) {
|
||||
me.frm.refresh_fields();
|
||||
frappe.model.set_value(cdt, cdn,
|
||||
"serial_and_batch_bundle", r.name);
|
||||
|
||||
me.frm.save();
|
||||
frappe.model.set_value(item.doctype, item.name, {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"qty": Math.abs(r.total_qty)
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -1,11 +1,11 @@
|
||||
import frappe
|
||||
from frappe.query_builder.functions import CombineDatetime, Sum
|
||||
from frappe.utils import flt
|
||||
from frappe.utils.deprecations import deprecated
|
||||
|
||||
|
||||
class DeprecatedSerialNoValuation:
|
||||
# Will be deprecated in v16
|
||||
|
||||
@deprecated
|
||||
def calculate_stock_value_from_deprecarated_ledgers(self):
|
||||
serial_nos = list(
|
||||
filter(lambda x: x not in self.serial_no_incoming_rate and x, self.get_serial_nos())
|
||||
@ -25,6 +25,7 @@ class DeprecatedSerialNoValuation:
|
||||
|
||||
self.stock_value_change += stock_value_change
|
||||
|
||||
@deprecated
|
||||
def get_incoming_value_for_serial_nos(self, serial_nos):
|
||||
# get rate from serial nos within same company
|
||||
all_serial_nos = frappe.get_all(
|
||||
@ -66,12 +67,14 @@ class DeprecatedSerialNoValuation:
|
||||
|
||||
|
||||
class DeprecatedBatchNoValuation:
|
||||
@deprecated
|
||||
def calculate_avg_rate_from_deprecarated_ledgers(self):
|
||||
entries = self.get_sle_for_batches()
|
||||
for ledger in entries:
|
||||
self.batch_avg_rate[ledger.batch_no] += flt(ledger.batch_value) / flt(ledger.batch_qty)
|
||||
self.available_qty[ledger.batch_no] += flt(ledger.batch_qty)
|
||||
|
||||
@deprecated
|
||||
def get_sle_for_batches(self):
|
||||
batch_nos = list(self.batch_nos.keys())
|
||||
sle = frappe.qb.DocType("Stock Ledger Entry")
|
||||
|
@ -1116,11 +1116,10 @@ erpnext.stock.select_batch_and_serial_no = (frm, item) => {
|
||||
new erpnext.SerialBatchPackageSelector(
|
||||
frm, item, (r) => {
|
||||
if (r) {
|
||||
frm.refresh_fields();
|
||||
frappe.model.set_value(item.doctype, item.name,
|
||||
"serial_and_batch_bundle", r.name);
|
||||
|
||||
frm.save();
|
||||
frappe.model.set_value(item.doctype, item.name, {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"qty": Math.abs(r.total_qty)
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -5,6 +5,7 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import cint, flt, getdate
|
||||
from frappe.utils.deprecations import deprecated
|
||||
from pypika import functions as fn
|
||||
|
||||
from erpnext.stock.doctype.warehouse.warehouse import apply_warehouse_filter
|
||||
@ -68,14 +69,13 @@ def get_columns(filters):
|
||||
|
||||
|
||||
def get_stock_ledger_entries(filters):
|
||||
# Will be deprecated in v16
|
||||
entries = get_stock_ledger_entries_for_batch_no(filters)
|
||||
|
||||
entries += get_stock_ledger_entries_for_batch_bundle(filters)
|
||||
return entries
|
||||
|
||||
|
||||
# get all details
|
||||
@deprecated
|
||||
def get_stock_ledger_entries_for_batch_no(filters):
|
||||
if not filters.get("from_date"):
|
||||
frappe.throw(_("'From Date' is required"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user