Merge lp:~numerigraphe-team/openobject-addons/7.0-inventory-move-date into lp:openobject-addons/7.0

Proposed by Lionel Sausin - Initiatives/Numérigraphe
Status: Work in progress
Proposed branch: lp:~numerigraphe-team/openobject-addons/7.0-inventory-move-date
Merge into: lp:openobject-addons/7.0
Diff against target: 36 lines (+9/-1)
1 file modified
stock/stock.py (+9/-1)
To merge this branch: bzr merge lp:~numerigraphe-team/openobject-addons/7.0-inventory-move-date
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+213302@code.launchpad.net

Description of the change

This branch fixes the date of stock moves for inventory adjustments.
It uses the inventory's date instead of "today", which makes it consistent with the way the starting quantity is already computed.

Entering moves this way was debated at length and judged acceptable for v8, and is implemented in trunk-wms.

This branch runs green on runbot: http://runbot.openerp.com/numerigraphe-team-7-0-inventory-move-date-32085/logs/

To post a comment you must log in.
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

Looks like Quentin changed his mind on this topic: https://bugs.launchpad.net/openobject-addons/+bug/915568/comments/44
Depending on the final call, this proposal could be unsustainable when v8 comes. I can always make this a module in that case.
Wait and see.

Unmerged revisions

9409. By Numérigraphe

[REF] Use the same context key as in trunk-wms to ease future migrations to v8

9408. By Numérigraphe

[MERGE] upstream updates

9407. By Numérigraphe

[REF] cosmetics

9406. By Numérigraphe

[FIX] write inventory stock moves at the right date

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2014-03-13 09:50:54 +0000
3+++ stock/stock.py 2014-03-28 16:52:06 +0000
4@@ -2424,7 +2424,11 @@
5 if todo:
6 self.action_confirm(cr, uid, todo, context=context)
7
8- self.write(cr, uid, move_ids, {'state': 'done', 'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)}, context=context)
9+ # Mark the move done, either now or at the datetime required by the context (ie. inventory being done)
10+ self.write(cr, uid, move_ids,
11+ {'state': 'done',
12+ 'date': context.get('force_date', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))},
13+ context=context)
14 for id in move_ids:
15 wf_service.trg_trigger(uid, 'stock.move', id, cr)
16
17@@ -2829,8 +2833,11 @@
18 """
19 if context is None:
20 context = {}
21+ else:
22+ context = context.copy()
23 move_obj = self.pool.get('stock.move')
24 for inv in self.browse(cr, uid, ids, context=context):
25+ context['force_date'] = inv.date
26 move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context=context)
27 self.write(cr, uid, [inv.id], {'state':'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
28 return True
29@@ -2862,6 +2869,7 @@
30 'product_uom': line.product_uom.id,
31 'prodlot_id': lot_id,
32 'date': inv.date,
33+ 'date_expected': inv.date,
34 }
35
36 if change > 0: