mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-22 10:56:30 +00:00
fix: bypass validation during reposting
(cherry picked from commit3697b9fd9b) (cherry picked from commit01aad96b10)
This commit is contained in:
committed by
Mergify
parent
52257c946e
commit
eaaac6e596
@@ -3989,6 +3989,8 @@ class TestPurchaseReceipt(FrappeTestCase):
|
|||||||
make_purchase_return,
|
make_purchase_return,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
frappe.flags.through_repost_item_valuation = False
|
||||||
|
|
||||||
sn_item_code = make_item(
|
sn_item_code = make_item(
|
||||||
"Test Serial No for Validation", {"has_serial_no": 1, "serial_no_series": "SN-TSNFVAL-.#####"}
|
"Test Serial No for Validation", {"has_serial_no": 1, "serial_no_series": "SN-TSNFVAL-.#####"}
|
||||||
).name
|
).name
|
||||||
@@ -4020,6 +4022,8 @@ class TestPurchaseReceipt(FrappeTestCase):
|
|||||||
make_purchase_return,
|
make_purchase_return,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
frappe.flags.through_repost_item_valuation = False
|
||||||
|
|
||||||
batch_item_code = make_item(
|
batch_item_code = make_item(
|
||||||
"Test Batch No for Validation",
|
"Test Batch No for Validation",
|
||||||
{"has_batch_no": 1, "batch_number_series": "BT-TSNFVAL-.#####", "create_new_batch": 1},
|
{"has_batch_no": 1, "batch_number_series": "BT-TSNFVAL-.#####", "create_new_batch": 1},
|
||||||
|
|||||||
@@ -322,6 +322,15 @@ class SerialandBatchBundle(Document):
|
|||||||
else:
|
else:
|
||||||
valuation_rate = valuation_details["batches"].get(row.batch_no)
|
valuation_rate = valuation_details["batches"].get(row.batch_no)
|
||||||
|
|
||||||
|
if frappe.flags.through_repost_item_valuation and not valuation_rate:
|
||||||
|
# if different serial nos / batches are returned
|
||||||
|
if row.serial_no:
|
||||||
|
serial_nos = sorted(list(valuation_details["serial_nos"].keys()))
|
||||||
|
valuation_rate = valuation_details["serial_nos"].get(serial_nos[cint(row.idx) - 1])
|
||||||
|
else:
|
||||||
|
batches = sorted(list(valuation_details["batches"].keys()))
|
||||||
|
valuation_rate = valuation_details["batches"].get(batches[cint(row.idx) - 1])
|
||||||
|
|
||||||
row.incoming_rate = flt(valuation_rate)
|
row.incoming_rate = flt(valuation_rate)
|
||||||
row.stock_value_difference = flt(row.qty) * flt(row.incoming_rate)
|
row.stock_value_difference = flt(row.qty) * flt(row.incoming_rate)
|
||||||
|
|
||||||
@@ -337,6 +346,9 @@ class SerialandBatchBundle(Document):
|
|||||||
self.set_incoming_rate_for_inward_transaction(row, save)
|
self.set_incoming_rate_for_inward_transaction(row, save)
|
||||||
|
|
||||||
def validate_returned_serial_batch_no(self, return_against, row, original_inv_details):
|
def validate_returned_serial_batch_no(self, return_against, row, original_inv_details):
|
||||||
|
if frappe.flags.through_repost_item_valuation:
|
||||||
|
return
|
||||||
|
|
||||||
if row.serial_no and row.serial_no not in original_inv_details["serial_nos"]:
|
if row.serial_no and row.serial_no not in original_inv_details["serial_nos"]:
|
||||||
self.throw_error_message(
|
self.throw_error_message(
|
||||||
_(
|
_(
|
||||||
|
|||||||
Reference in New Issue
Block a user