Merge pull request #45241 from rohitwaghchaure/fixed-support-28979

fix: auto fetch batch and serial no for draft stock transactions
This commit is contained in:
rohitwaghchaure
2025-01-14 12:35:17 +05:30
committed by GitHub
5 changed files with 180 additions and 4 deletions

View File

@@ -779,7 +779,14 @@ class AccountsController(TransactionBase):
ret = get_item_details(ctx, self, for_validate=for_validate, overwrite_warehouse=False)
for fieldname, value in ret.items():
if item.meta.get_field(fieldname) and value is not None:
if item.get(fieldname) is None or fieldname in force_item_fields:
if (
item.get(fieldname) is None
or fieldname in force_item_fields
or (
fieldname in ["serial_no", "batch_no"]
and item.get("use_serial_batch_fields")
)
):
item.set(fieldname, value)
elif fieldname in ["cost_center", "conversion_factor"] and not item.get(