From 8890c2b820f04a25b76ad4df6a0e424e876a14cf Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Tue, 3 May 2011 12:55:13 +0530 Subject: [PATCH 1/2] [FIX]stock:Fixed:cannot change date in Incoming shipment order,delivery order and internal shipment lp bug: https://launchpad.net/bugs/770168 fixed bzr revid: ron@tinyerp.com-20110503072513-ms2lwczlsjdcj65r --- addons/stock/stock.py | 12 +++++++++++- addons/stock/stock_view.xml | 10 +++++----- 2 files changed, 16 insertions(+), 6 deletions(-) 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 @@ - + From 30f6afd2aaf7ec0af7d46b3a0820494dff022958 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 4 May 2011 10:41:34 +0530 Subject: [PATCH 2/2] [IMP]:stock:include time value in Move Date field bzr revid: ron@tinyerp.com-20110504051134-x1ok2q9hv30b5mvh --- addons/stock/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 2c46e8dd63e..ccc9ac54949 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1760,7 +1760,7 @@ class stock_move(osv.osv): @return: Move Date """ if not date_expected: - date_expected = time.strftime('%Y-%m-%d'), + date_expected = time.strftime('%Y-%m-%d %H:%M:%S') return {'value':{'date': date_expected}} def _chain_compute(self, cr, uid, moves, context=None):