fix: auto fetch batch and serial no for draft stock transactions

This commit is contained in:
Rohit Waghchaure
2025-01-13 16:34:08 +05:30
parent 00dadc1a89
commit 88ab9be79c
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(