mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-19 01:18:43 +00:00
chore: fix conflicts
Removed unused methods related to stock ledger entries and negative stock handling.
This commit is contained in:
@@ -16,12 +16,7 @@ from erpnext.stock.doctype.serial_and_batch_bundle.serial_and_batch_bundle impor
|
||||
get_available_serial_nos,
|
||||
)
|
||||
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
|
||||
<<<<<<< HEAD
|
||||
from erpnext.stock.utils import get_combine_datetime, get_incoming_rate, get_stock_balance
|
||||
=======
|
||||
from erpnext.stock.doctype.stock_reconciliation_item.stock_reconciliation_item import StockReconciliationItem
|
||||
from erpnext.stock.utils import get_incoming_rate, get_stock_balance
|
||||
>>>>>>> e36426e235 (fix: do not allow to make changes in SABB after submit)
|
||||
|
||||
|
||||
class OpeningEntryAccountError(frappe.ValidationError):
|
||||
@@ -1022,148 +1017,6 @@ class StockReconciliation(StockController):
|
||||
else:
|
||||
self._cancel()
|
||||
|
||||
<<<<<<< HEAD
|
||||
def add_missing_stock_ledger_entry(self, row, voucher_detail_no, sle_creation):
|
||||
if row.current_qty == 0:
|
||||
return
|
||||
|
||||
new_sle = frappe.get_doc(self.get_sle_for_items(row))
|
||||
new_sle.actual_qty = row.current_qty * -1
|
||||
new_sle.valuation_rate = row.current_valuation_rate
|
||||
new_sle.serial_and_batch_bundle = row.current_serial_and_batch_bundle
|
||||
new_sle.flags.ignore_permissions = 1
|
||||
new_sle.submit()
|
||||
|
||||
creation = add_to_date(sle_creation, seconds=-1)
|
||||
new_sle.db_set("creation", creation)
|
||||
|
||||
if not frappe.db.exists(
|
||||
"Repost Item Valuation",
|
||||
{"item": row.item_code, "warehouse": row.warehouse, "docstatus": 1, "status": "Queued"},
|
||||
):
|
||||
create_repost_item_valuation_entry(
|
||||
{
|
||||
"based_on": "Item and Warehouse",
|
||||
"item_code": row.item_code,
|
||||
"warehouse": row.warehouse,
|
||||
"company": self.company,
|
||||
"allow_negative_stock": 1,
|
||||
"posting_date": self.posting_date,
|
||||
"posting_time": self.posting_time,
|
||||
}
|
||||
)
|
||||
|
||||
def has_negative_stock_allowed(self):
|
||||
allow_negative_stock = cint(frappe.db.get_single_value("Stock Settings", "allow_negative_stock"))
|
||||
if allow_negative_stock:
|
||||
return True
|
||||
|
||||
if any(
|
||||
((d.serial_and_batch_bundle or d.batch_no) and flt(d.qty) == flt(d.current_qty))
|
||||
for d in self.items
|
||||
):
|
||||
allow_negative_stock = True
|
||||
|
||||
return allow_negative_stock
|
||||
|
||||
def get_current_qty_for_serial_or_batch(self, row, sle_creation):
|
||||
doc = frappe.get_doc("Serial and Batch Bundle", row.current_serial_and_batch_bundle)
|
||||
current_qty = 0.0
|
||||
if doc.has_serial_no:
|
||||
current_qty = self.get_current_qty_for_serial_nos(doc, sle_creation)
|
||||
elif doc.has_batch_no:
|
||||
current_qty = self.get_current_qty_for_batch_nos(doc, sle_creation)
|
||||
|
||||
return abs(current_qty)
|
||||
|
||||
def get_current_qty_for_serial_nos(self, doc, sle_creation):
|
||||
serial_nos_details = get_available_serial_nos(
|
||||
frappe._dict(
|
||||
{
|
||||
"item_code": doc.item_code,
|
||||
"warehouse": doc.warehouse,
|
||||
"posting_date": self.posting_date,
|
||||
"posting_time": self.posting_time,
|
||||
"creation": sle_creation,
|
||||
"voucher_no": self.name,
|
||||
"ignore_warehouse": 1,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
if not serial_nos_details:
|
||||
return 0.0
|
||||
|
||||
doc.delete_serial_batch_entries()
|
||||
current_qty = 0.0
|
||||
for serial_no_row in serial_nos_details:
|
||||
current_qty += 1
|
||||
doc.append(
|
||||
"entries",
|
||||
{
|
||||
"serial_no": serial_no_row.serial_no,
|
||||
"qty": -1,
|
||||
"warehouse": doc.warehouse,
|
||||
"batch_no": serial_no_row.batch_no,
|
||||
},
|
||||
)
|
||||
|
||||
doc.set_incoming_rate(save=True)
|
||||
doc.calculate_qty_and_amount(save=True)
|
||||
doc.db_update_all()
|
||||
|
||||
return current_qty
|
||||
|
||||
def get_current_qty_for_batch_nos(self, doc, sle_creation):
|
||||
current_qty = 0.0
|
||||
precision = doc.entries[0].precision("qty")
|
||||
for d in doc.entries:
|
||||
qty = (
|
||||
get_batch_qty(
|
||||
d.batch_no,
|
||||
doc.warehouse,
|
||||
creation=sle_creation,
|
||||
posting_date=doc.posting_date,
|
||||
posting_time=doc.posting_time,
|
||||
ignore_voucher_nos=[doc.voucher_no],
|
||||
for_stock_levels=True,
|
||||
consider_negative_batches=True,
|
||||
do_not_check_future_batches=True,
|
||||
)
|
||||
or 0
|
||||
) * -1
|
||||
|
||||
if flt(d.qty, precision) != flt(qty, precision):
|
||||
d.db_set("qty", qty)
|
||||
|
||||
current_qty += qty
|
||||
|
||||
return current_qty
|
||||
|
||||
|
||||
def get_batch_qty_for_stock_reco(
|
||||
item_code, warehouse, batch_no, posting_date, posting_time, voucher_no, sle_creation
|
||||
):
|
||||
qty = (
|
||||
get_batch_qty(
|
||||
batch_no,
|
||||
warehouse,
|
||||
item_code,
|
||||
creation=sle_creation,
|
||||
posting_date=posting_date,
|
||||
posting_time=posting_time,
|
||||
ignore_voucher_nos=[voucher_no],
|
||||
for_stock_levels=True,
|
||||
consider_negative_batches=True,
|
||||
do_not_check_future_batches=True,
|
||||
)
|
||||
or 0
|
||||
)
|
||||
|
||||
return flt(qty)
|
||||
|
||||
=======
|
||||
>>>>>>> e36426e235 (fix: do not allow to make changes in SABB after submit)
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_items(warehouse, posting_date, posting_time, company, item_code=None, ignore_empty_stock=False):
|
||||
|
||||
Reference in New Issue
Block a user