Tryton - Issues

 

Issue6931

Title Complete Inventory discards inactive products on update
Priority bug Status in-progress
Superseder Nosy List albertca, ced
Type behavior Components stock
Assigned To albertca Keywords review
Reviews 38931002
View: 38931002

Created on 2017-11-11.00:07:15 by albertca, last changed by albertca.

Messages
msg36833 (view) Author: [hidden] (albertca) (Tryton committer) (Tryton translator) Date: 2017-11-11.01:03:52
I hesitated on what was the best option. For me it sounds good to make inventory for inactive products too.

Updated review with this change.
msg36832 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-11-11.00:48:16
I think the active part of this test should be removed. It is not because a product is inactive that we can not make an inventory if we have product left.
msg36831 (view) Author: [hidden] (albertca) (Tryton committer) (Tryton translator) Date: 2017-11-11.00:07:14
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.
History
Date User Action Args
2017-11-11 01:07:47albertcasettitle: Complete Inventory button creates lines for inactive products -> Complete Inventory discards inactive products on update
2017-11-11 01:03:52albertcasetreviews: 38931002
messages: + msg36833
keyword: + review
2017-11-11 00:48:16cedsetnosy: + ced
messages: + msg36832
2017-11-11 00:07:15albertcacreate

Showing 10 items. Show all history (warning: this could be VERY long)