openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #05472
[Merge] lp:~numerigraphe-team/ocb-addons/7.0-inventory-move-date into lp:ocb-addons
Lionel Sausin - Numérigraphe has proposed merging lp:~numerigraphe-team/ocb-addons/7.0-inventory-move-date into lp:ocb-addons.
Requested reviews:
OpenERP Community Backports Team (ocb)
Related bugs:
Bug #915568 in OpenERP Community Backports (Addons): "Wrong dates used when confirming stock inventory"
https://bugs.launchpad.net/ocb-addons/+bug/915568
For more details, see:
https://code.launchpad.net/~numerigraphe-team/ocb-addons/7.0-inventory-move-date/+merge/213301
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 the right thing to do for v8, and is implemented in trunk-wms.
The branch branch this one is based upon (before merging OCB to resolve conflicts) runs green on runbot: http://runbot.openerp.com/numerigraphe-team-7-0-inventory-move-date-32085/logs/
Proposal for upstream v7.0: https://code.launchpad.net/~numerigraphe-team/ocb-addons/7.0-inventory-move-date/+merge/213301
--
https://code.launchpad.net/~numerigraphe-team/ocb-addons/7.0-inventory-move-date/+merge/213301
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~numerigraphe-team/ocb-addons/7.0-inventory-move-date into lp:ocb-addons.
=== modified file 'stock/stock.py'
--- stock/stock.py 2014-03-24 09:12:54 +0000
+++ stock/stock.py 2014-03-28 16:49:37 +0000
@@ -2448,9 +2448,10 @@
self._create_product_valuation_moves(cr, uid, move, context=context)
if move.state not in ('confirmed','done','assigned'):
self.action_confirm(cr, uid, [move.id], context=context)
+ # Mark the move done, either now or at the datetime required by the context (ie. inventory being done)
self.write(cr, uid, [move.id],
{'state': 'done',
- 'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)},
+ 'date': context.get('force_date', time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))},
context=context)
for id in move_ids:
wf_service.trg_trigger(uid, 'stock.move', id, cr)
@@ -2869,8 +2870,11 @@
"""
if context is None:
context = {}
+ else:
+ context = context.copy()
move_obj = self.pool.get('stock.move')
for inv in self.browse(cr, uid, ids, context=context):
+ context['force_date'] = inv.date
move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context=context)
self.write(cr, uid, [inv.id], {'state':'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
return True
@@ -2902,6 +2906,7 @@
'product_uom': line.product_uom.id,
'prodlot_id': lot_id,
'date': inv.date,
+ 'date_expected': inv.date,
}
if change > 0:
References