On import, set blank stock values to zero instead of destroying [SCI-10912]

This commit is contained in:
Martin Artnik 2024-07-23 12:54:04 +02:00
parent 82557d31d6
commit a135b6fb59

View file

@ -217,7 +217,7 @@ module RepositoryImportParser
repository_cell.to_destroy = true repository_cell.to_destroy = true
@updated = true @updated = true
else else
repository_cell.value.destroy! erase_cell!(repository_cell)
end end
repository_cell repository_cell
@ -302,5 +302,20 @@ module RepositoryImportParser
# all rows minus header # all rows minus header
@rows.count - 1 @rows.count - 1
end end
def erase_cell!(repository_cell)
case repository_cell.value
when RepositoryStockValue
repository_cell.value.update_data!(
{
amount: 0,
unit_item_id: repository_cell.value.repository_stock_unit_item_id
},
@user
)
else
repository_cell.value.destroy!
end
end
end end
end end