fix: Lock row in subquery while setting delivered qty (#23100)

This commit is contained in:
Rucha Mahabal 2020-09-08 11:57:45 +05:30 committed by GitHub
parent 9691422fb7
commit f7619df8b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -255,7 +255,7 @@ class StatusUpdater(Document):
args['second_source_condition'] = """ + ifnull((select sum(%(second_source_field)s)
from `tab%(second_source_dt)s`
where `%(second_join_field)s`="%(detail_id)s"
and (`tab%(second_source_dt)s`.docstatus=1) %(second_source_extra_cond)s), 0) """ % args
and (`tab%(second_source_dt)s`.docstatus=1) %(second_source_extra_cond)s FOR UPDATE), 0)""" % args
if args['detail_id']:
if not args.get("extra_cond"): args["extra_cond"] = ""