mirror of
https://github.com/frappe/erpnext.git
synced 2026-10-29 22:57:42 +00:00
fix: treat any stock entry row with source and target warehouse as a transfer
(cherry picked from commit eb0c8cbe00)
This commit is contained in:
@@ -241,7 +241,7 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Only works for Purchase Receipt, Purchase Invoice with Update Stock and Stock Entry that is not a material transfer",
|
||||
"description": "Only works for Purchase Receipt, Purchase Invoice with Update Stock and Stock Entry with no row that has both a Source and Target Warehouse",
|
||||
"fieldname": "recalculate_valuation_rate",
|
||||
"fieldtype": "Check",
|
||||
"label": "Recalculate Valuation Rate",
|
||||
|
||||
@@ -18,7 +18,6 @@ from erpnext.projects.doctype.project.project import update_consumed_material_co
|
||||
from erpnext.stock.stock_ledger import (
|
||||
get_affected_transactions,
|
||||
get_items_to_be_repost,
|
||||
is_transfer_stock_entry,
|
||||
repost_future_sle,
|
||||
)
|
||||
from erpnext.utilities import clear_logs_with_references
|
||||
@@ -107,7 +106,7 @@ class RepostItemValuation(Document):
|
||||
if self.recalculate_valuation_rate and not self.can_recalculate_valuation_rate():
|
||||
frappe.throw(
|
||||
_(
|
||||
"Recalculate Valuation Rate is only allowed for a Purchase Receipt, a Purchase Invoice with Update Stock or a Stock Entry that is not a material transfer"
|
||||
"Recalculate Valuation Rate is only allowed for a Purchase Receipt, a Purchase Invoice with Update Stock or a Stock Entry with no row that has both a Source and Target Warehouse"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -122,7 +121,10 @@ class RepostItemValuation(Document):
|
||||
return bool(frappe.db.get_value("Purchase Invoice", self.voucher_no, "update_stock"))
|
||||
|
||||
if self.voucher_type == "Stock Entry":
|
||||
return not is_transfer_stock_entry(self.voucher_no)
|
||||
return not frappe.db.exists(
|
||||
"Stock Entry Detail",
|
||||
{"parent": self.voucher_no, "s_warehouse": ("is", "set"), "t_warehouse": ("is", "set")},
|
||||
)
|
||||
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user