Tryton - Issues

 

Issue6931

Title Complete Inventory discards inactive products on update
Priority bug Status resolved
Superseder Nosy List albertca, ced, roundup-bot
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 roundup-bot.

Messages
New changeset 07ebc783b700 by Albert Cervera i Areny in branch '4.6':
Do not delete inventory line of inactive product
http://hg.tryton.org/modules/stock/rev/07ebc783b700

New changeset 01a8cefa0e1b by Albert Cervera i Areny in branch '4.4':
Do not delete inventory line of inactive product
http://hg.tryton.org/modules/stock/rev/01a8cefa0e1b

New changeset e00444f40580 by Albert Cervera i Areny in branch '4.2':
Do not delete inventory line of inactive product
http://hg.tryton.org/modules/stock/rev/e00444f40580

New changeset 74c14fb5c975 by Albert Cervera i Areny in branch '4.0':
Do not delete inventory line of inactive product
http://hg.tryton.org/modules/stock/rev/74c14fb5c975

New changeset d5cb31e65d2e by Albert Cervera i Areny in branch '3.8':
Do not delete inventory line of inactive product
http://hg.tryton.org/modules/stock/rev/d5cb31e65d2e
New changeset 7078f9a653db by Albert Cervera i Areny in branch 'default':
Do not delete inventory line of inactive product
http://hg.tryton.org/modules/stock/rev/7078f9a653db
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
2018-02-25 00:59:05roundup-botsetmessages: + msg38598
2018-02-13 19:26:33roundup-botsetstatus: in-progress -> resolved
nosy: + roundup-bot
messages: + msg38360
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)