To create the picking list of User defined argument and to the calculates planned date if it is greater than value and than if condition is true and its also user defined argument so you have to validate the Name of field and also Value of field and return the true condition and in stock_picking also calculate to the maximum date and check if condition is true and validate in stock_picking. Use this funciton show in given below
def maximum_date(self, cr, uid, ids, name, value, arg, context=None):
if not value:
return False
if isinstance(ids, (int, long)):
ids = [ids]
for pick in self.browse(cr, uid, ids, context=context):
sql_str = """update stock_move set
date='%s'
where
picking_id=%d """ % (value, pick.id)
if pick.max_date:
sql_str += " and (date='" + pick.max_date + "' or date>'" + value + "')"
cr.execute(sql_str)
return True
0 Comment(s)