Merge pull request #48787 from rohitwaghchaure/fixed-pervent-concurrent-issue

fix: concurrency issues
This commit is contained in:
rohitwaghchaure
2025-07-28 16:27:56 +05:30
committed by GitHub
2 changed files with 5 additions and 0 deletions

View File

@@ -160,6 +160,7 @@ class DeprecatedBatchNoValuation:
& (sle.batch_no.isnotnull()) & (sle.batch_no.isnotnull())
& (sle.is_cancelled == 0) & (sle.is_cancelled == 0)
) )
.for_update()
.groupby(sle.batch_no) .groupby(sle.batch_no)
) )
@@ -266,6 +267,7 @@ class DeprecatedBatchNoValuation:
& (sle.is_cancelled == 0) & (sle.is_cancelled == 0)
& (sle.batch_no.isin(self.non_batchwise_valuation_batches)) & (sle.batch_no.isin(self.non_batchwise_valuation_batches))
) )
.for_update()
.where(timestamp_condition) .where(timestamp_condition)
.groupby(sle.batch_no) .groupby(sle.batch_no)
) )
@@ -312,6 +314,7 @@ class DeprecatedBatchNoValuation:
.where(timestamp_condition) .where(timestamp_condition)
.orderby(sle.posting_datetime, order=Order.desc) .orderby(sle.posting_datetime, order=Order.desc)
.orderby(sle.creation, order=Order.desc) .orderby(sle.creation, order=Order.desc)
.for_update()
.limit(1) .limit(1)
) )
@@ -369,6 +372,7 @@ class DeprecatedBatchNoValuation:
& (bundle.type_of_transaction.isin(["Inward", "Outward"])) & (bundle.type_of_transaction.isin(["Inward", "Outward"]))
& (bundle_child.batch_no.isin(self.non_batchwise_valuation_batches)) & (bundle_child.batch_no.isin(self.non_batchwise_valuation_batches))
) )
.for_update()
.where(timestamp_condition) .where(timestamp_condition)
.groupby(bundle_child.batch_no) .groupby(bundle_child.batch_no)
) )

View File

@@ -755,6 +755,7 @@ class BatchNoValuation(DeprecatedBatchNoValuation):
& (parent.is_cancelled == 0) & (parent.is_cancelled == 0)
& (parent.type_of_transaction.isin(["Inward", "Outward"])) & (parent.type_of_transaction.isin(["Inward", "Outward"]))
) )
.for_update()
.groupby(child.batch_no) .groupby(child.batch_no)
) )