Complete Inventory discards inactive products on update
Steps to reproduce:
- Create product A
- Add 1 unit of product A to storage location
- Deactivate product A
- Create an inventory on storage location
- Click on "Complete Lines"
The inventory will include a line for product A with both "Expected Quantity" and "Quantity" fields set to 1. Now change the quantity of the line to "2" and save.
The line will have disappeared.
The reason for the product disappearing is in the following code where it ensures that product is active when updating the lines:
# Update existing lines
for line in inventory.lines:
if not (line.product.active and
line.product.type == 'goods'
and not line.product.consumable):
Line.delete([line])
continue
But, there's no such check when lines are created for the first time.