diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 8e60ba9ab50..2c46e8dd63e 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1517,7 +1517,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)]}), @@ -1753,6 +1753,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'), + 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 6dfd38c37b1..d1bc8cfd19a 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -769,7 +769,7 @@ - + @@ -961,7 +961,7 @@ - + @@ -1181,7 +1181,7 @@ - + @@ -1449,7 +1449,7 @@ - + @@ -1644,7 +1644,7 @@ - +