161
162
raise osv.except_osv(_('Error'), _('You should select one order to follow !'))
163
164
followup_id = False
165
166
for o in order_obj.browse(cr, uid, ids, context=context):
166
167
followup_id = self.create(cr, uid, {'order_id': o.id}, context=context)
168
169
for line in o.order_line:
169
170
split_line_ids = sol_obj.search(cr, uid, [('original_line_id', '=', line.id)], context=context)
170
171
first_line = True
172
172
if split_line_ids:
173
173
split_lines = True
174
174
lines = sol_obj.browse(cr, uid, split_line_ids, context=context)
337
337
return tender_ids
339
def export_get_file_name(self, cr, uid, ids, prefix='FO_Follow_Up', context=None):
340
if isinstance(ids, (int, long)):
344
foup = self.browse(cr, uid, ids[0], context=context)
345
if not foup or not foup.order_id or not foup.order_id.name:
347
dt_now = datetime.datetime.now()
348
po_name = "%s_%s_%d_%02d_%02d" % (prefix,
349
foup.order_id.name.replace('/', '_'),
350
dt_now.year, dt_now.month, dt_now.day)
353
def export_xls(self, cr, uid, ids, context=None):
355
Print the report (Excel)
357
if isinstance(ids, (int, long)):
360
file_name = self.export_get_file_name(cr, uid, ids, context=context)
362
datas['target_filename'] = file_name
364
'type': 'ir.actions.report.xml',
365
'report_name': 'sales.follow.up.report_xls',
371
def export_pdf(self, cr, uid, ids, context=None):
373
Print the report (PDF)
375
if isinstance(ids, (int, long)):
378
file_name = self.export_get_file_name(cr, uid, ids, context=context)
380
datas['target_filename'] = file_name
382
'type': 'ir.actions.report.xml',
383
'report_name': 'sales.follow.up.report_pdf',
340
389
sale_order_followup()
342
392
class sale_order_line_followup(osv.osv_memory):
343
393
_name = 'sale.order.line.followup'
344
394
_description = 'Sales Order Lines Followup'
970
1020
if context.get('from_followup'):
972
1022
if name and len(name) > 1:
973
ids.extend(self.search(cr, uid, [('client_order_ref', operator, name)], context=context))
975
return self.name_get(cr, uid, ids, context=context)
1023
args2 = [('client_order_ref', operator, name)]
1026
ids.extend(self.search(cr, uid, args2, context=context))
1027
res = self.name_get(cr, uid, ids, context=context)
977
return super(sale_order, self).name_search(cr, uid, name, args, operator, context, limit)
1029
res = super(sale_order, self).name_search(cr, uid, name, args, operator, context, limit)
979
1032
def name_get(self, cr, uid, ids, context=None):