bzr revid: fp@tinyerp.com-20110917120340-b50aw2dcsr7dysh3
This commit is contained in:
Fabien Pinckaers
2011-09-17 14:03:40 +02:00
2 changed files with 16 additions and 6 deletions
+11 -1
View File
@@ -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
+5 -5
View File
@@ -769,7 +769,7 @@
<separator string="Dates" colspan="2" />
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)"/>
</group>
<group colspan="2" col="4" groups="base.group_extended">
@@ -960,7 +960,7 @@
<separator string="Dates" colspan="2" />
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)"/>
</group>
<group colspan="2" col="4" groups="base.group_extended">
@@ -1180,7 +1180,7 @@
<separator string="Dates" colspan="2" />
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)"/>
</group>
<group colspan="2" col="4" groups="base.group_extended">
@@ -1446,7 +1446,7 @@
<separator string="Dates" colspan="2" />
<field name="create_date" groups="base.group_extended"/>
<field name="date" groups="base.group_extended"/>
<field name="date_expected"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)"/>
</group>
<group colspan="2" col="4" groups="base.group_extended">
@@ -1635,7 +1635,7 @@
<separator string="Dates" colspan="2" />
<field name="create_date" groups="base.group_extended"/>
<field name="date" groups="base.group_extended"/>
<field name="date_expected"/>
<field name="date_expected" on_change="onchange_date(date,date_expected)"/>
</group>
<group colspan="2" col="4" groups="base.group_extended">