227
227
"packing and have a date in the past",
228
228
'stock_move_old_active_orphan_stock')
230
min_confirmed_date = self.__days_ago(60)
231
min_other_date = self.__days_ago(30)
230
min_date = self.__days_ago(30)
233
232
ids = self.search(cr,uid,[
234
233
("picking_id", "=", None),
237
236
('state', '=', 'confirmed'),
238
('date', '<=', min_confirmed_date),
237
('date', '<=', min_date),
240
239
('state', 'in', ['draft', 'auto', 'assigned']),
241
('date', '<=', min_other_date)
240
('date', '<=', min_date)
245
244
return # none found
248
"The following are active stock moves " +
249
"with old dates and with no related packing\n\n")
246
problem_writeup = "The following are active stock moves with old dates and with no related packing\n\n"
250
247
for move in self.browse(cr,uid,ids,context):
251
248
if move.state == "confirmed":
252
problem_writeup += "-%s\t%s\t%s - %s\n" % (
249
problem_writeup += "-%s %s %s - %s\n" % (
256
move.product_id.name)
252
move.name.encode('ascii',errors='ignore'),
253
move.product_id.name.encode('ascii',errors='ignore'))
258
255
problem_writeup += "\n"
260
257
for move in self.browse(cr,uid,ids,context):
261
258
if move.state != "confirmed":
262
problem_writeup += "-%s\t%s\t%s - %s\n" % (
259
problem_writeup += "-%s %s %s - %s\n" % (
266
move.product_id.name)
262
move.name.encode('ascii',errors='ignore'),
263
move.product_id.name.encode('ascii',errors='ignore'))
268
265
# now that we've finished documenting the problem let's notify the
269
266
# appropriate users