diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 461f7c2ddbf..1c100cb24b7 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1521,7 +1521,7 @@ class stock_move(osv.osv): 'name': fields.char('Name', size=64, required=True, select=True), 'priority': fields.selection([('0', 'Not urgent'), ('1', 'Urgent')], 'Priority'), 'create_date': fields.datetime('Creation Date', readonly=True, select=True), - 'date': fields.datetime('Date', required=True, select=True, help="Move date: scheduled date until move is done, then date of actual move processing", readonly=True), + 'date': fields.datetime('Date', required=True, select=True, help="Move date: scheduled date until move is done, then date of actual move processing", states={'done': [('readonly', True)]}), 'date_expected': fields.datetime('Scheduled Date', states={'done': [('readonly', True)]},required=True, select=True, help="Scheduled date for the processing of this move"), 'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')],states={'done': [('readonly', True)]}), @@ -1757,6 +1757,16 @@ class stock_move(osv.osv): result['location_dest_id'] = loc_dest_id return {'value': result} + def onchange_date(self, cr, uid, ids, date, date_expected, context=None): + """ On change of Scheduled Date gives a Move date. + @param date_expected: Scheduled Date + @param date: Move Date + @return: Move Date + """ + if not date_expected: + date_expected = time.strftime('%Y-%m-%d %H:%M:%S') + return {'value':{'date': date_expected}} + def _chain_compute(self, cr, uid, moves, context=None): """ Finds whether the location has chained location type or not. @param moves: Stock moves diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 24f4ff8cc7f..6a6566d8bf9 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -769,7 +769,7 @@ - + @@ -960,7 +960,7 @@ - + @@ -1180,7 +1180,7 @@ - + @@ -1446,7 +1446,7 @@ - + @@ -1635,7 +1635,7 @@ - +