mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
Merge pull request #49722 from rohitwaghchaure/fixed-test-case-test_backdated_stock_reco_entry
chore: fixed test case test_backdated_stock_reco_entry
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
from typing import TYPE_CHECKING, overload
|
from typing import TYPE_CHECKING, overload
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import cint, flt
|
from frappe.utils import cint, flt, today
|
||||||
|
|
||||||
import erpnext
|
import erpnext
|
||||||
from erpnext.stock.utils import get_combine_datetime
|
from erpnext.stock.utils import get_combine_datetime
|
||||||
@@ -77,6 +77,9 @@ def make_stock_entry(**args):
|
|||||||
if args.inspection_required:
|
if args.inspection_required:
|
||||||
s.inspection_required = args.inspection_required
|
s.inspection_required = args.inspection_required
|
||||||
|
|
||||||
|
if not args.posting_date:
|
||||||
|
s.posting_date = today()
|
||||||
|
|
||||||
# map names
|
# map names
|
||||||
if args.from_warehouse:
|
if args.from_warehouse:
|
||||||
args.source = args.from_warehouse
|
args.source = args.from_warehouse
|
||||||
@@ -142,8 +145,8 @@ def make_stock_entry(**args):
|
|||||||
batches = args.batches
|
batches = args.batches
|
||||||
|
|
||||||
posting_datetime = None
|
posting_datetime = None
|
||||||
if args.posting_date and args.posting_time:
|
if s.posting_date and s.posting_time:
|
||||||
posting_datetime = get_combine_datetime(args.posting_date, args.posting_time)
|
posting_datetime = get_combine_datetime(s.posting_date, s.posting_time)
|
||||||
|
|
||||||
bundle_id = (
|
bundle_id = (
|
||||||
SerialBatchCreation(
|
SerialBatchCreation(
|
||||||
|
|||||||
@@ -25,7 +25,12 @@ from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import (
|
|||||||
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
|
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
|
||||||
from erpnext.stock.stock_ledger import get_previous_sle, update_entries_after
|
from erpnext.stock.stock_ledger import get_previous_sle, update_entries_after
|
||||||
from erpnext.stock.tests.test_utils import StockTestMixin
|
from erpnext.stock.tests.test_utils import StockTestMixin
|
||||||
from erpnext.stock.utils import get_incoming_rate, get_stock_value_on, get_valuation_method
|
from erpnext.stock.utils import (
|
||||||
|
get_combine_datetime,
|
||||||
|
get_incoming_rate,
|
||||||
|
get_stock_value_on,
|
||||||
|
get_valuation_method,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestStockReconciliation(IntegrationTestCase, StockTestMixin):
|
class TestStockReconciliation(IntegrationTestCase, StockTestMixin):
|
||||||
@@ -716,6 +721,13 @@ class TestStockReconciliation(IntegrationTestCase, StockTestMixin):
|
|||||||
rate=100,
|
rate=100,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
stock_reco.reload()
|
||||||
|
stock_reco_sabb = stock_reco.items[0].serial_and_batch_bundle
|
||||||
|
posting_datetime = frappe.db.get_value("Serial and Batch Bundle", stock_reco_sabb, "posting_datetime")
|
||||||
|
self.assertEqual(
|
||||||
|
posting_datetime, get_combine_datetime(stock_reco.posting_date, stock_reco.posting_time)
|
||||||
|
)
|
||||||
|
|
||||||
sle = frappe.get_all(
|
sle = frappe.get_all(
|
||||||
"Stock Ledger Entry",
|
"Stock Ledger Entry",
|
||||||
filters={"is_cancelled": 0, "voucher_no": stock_reco.name, "actual_qty": ("<", 0)},
|
filters={"is_cancelled": 0, "voucher_no": stock_reco.name, "actual_qty": ("<", 0)},
|
||||||
|
|||||||
@@ -241,12 +241,12 @@ def get_incoming_rate(args, raise_error_if_no_rate=True):
|
|||||||
"""Get Incoming Rate based on valuation method"""
|
"""Get Incoming Rate based on valuation method"""
|
||||||
from erpnext.stock.stock_ledger import get_previous_sle, get_valuation_rate
|
from erpnext.stock.stock_ledger import get_previous_sle, get_valuation_rate
|
||||||
|
|
||||||
if not args.get("posting_datetime") and args.get("posting_date"):
|
|
||||||
args["posting_datetime"] = get_combine_datetime(args.get("posting_date"), args.get("posting_time"))
|
|
||||||
|
|
||||||
if isinstance(args, str):
|
if isinstance(args, str):
|
||||||
args = json.loads(args)
|
args = json.loads(args)
|
||||||
|
|
||||||
|
if not args.get("posting_datetime") and args.get("posting_date"):
|
||||||
|
args["posting_datetime"] = get_combine_datetime(args.get("posting_date"), args.get("posting_time"))
|
||||||
|
|
||||||
in_rate = None
|
in_rate = None
|
||||||
|
|
||||||
item_details = frappe.get_cached_value(
|
item_details = frappe.get_cached_value(
|
||||||
|
|||||||
Reference in New Issue
Block a user