Merge lp:~numerigraphe/openobject-addons/6.0-stock-inventory-fill-duplicate into lp:openobject-addons/6.0

Proposed by Numérigraphe
Status: Needs review
Proposed branch: lp:~numerigraphe/openobject-addons/6.0-stock-inventory-fill-duplicate
Merge into: lp:openobject-addons/6.0
Diff against target: 23 lines (+7/-4)
1 file modified
stock/wizard/stock_fill_inventory.py (+7/-4)
To merge this branch: bzr merge lp:~numerigraphe/openobject-addons/6.0-stock-inventory-fill-duplicate
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+110282@code.launchpad.net

Description of the change

This branch proposes to fix a bug in the wizard to fill inventories : when run in a inventory which already contains lines, it generate duplicate lines when the quantities in stock are not the same as those in the inventory.
Lionel Sausin.

To post a comment you must log in.

Unmerged revisions

5233. By Numerigraphe - Lionel Sausin <email address hidden>

[FIX] stock: in import inventory wizard, don't add the same line twice when the quantity changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/wizard/stock_fill_inventory.py'
2--- stock/wizard/stock_fill_inventory.py 2012-04-25 12:22:20 +0000
3+++ stock/wizard/stock_fill_inventory.py 2012-06-14 10:05:41 +0000
4@@ -113,13 +113,16 @@
5 for stock_move in res.values():
6 for stock_move_details in stock_move.values():
7 stock_move_details.update({'inventory_id': context['active_ids'][0]})
8- domain = []
9-
10+
11 if fill_inventory.set_stock_zero:
12 stock_move_details.update({'product_qty': 0})
13
14- for field, value in stock_move_details.items():
15- domain.append((field, '=', value))
16+ domain = [(field, '=', stock_move_details[field])
17+ for field in ['location_id',
18+ 'product_id',
19+ 'prod_lot_id',
20+ 'inventory_id']
21+ ]
22
23 line_ids = inventory_line_obj.search(cr, uid, domain, context=context)
24