~jri-openerp/enapps-csv-import-tool/fully-patched

« back to all changes in this revision

Viewing changes to ea_import/ea_import_chain_result.py

  • Committer: Enapps Ltd.
  • Date: 2012-04-10 11:00:44 UTC
  • Revision ID: openerp@enapps.co.uk-20120410110044-96aqd5mkrnlf4ptg
launchpad

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    Copyright (C) 2012 Enapps LTD (<http://www.enapps.co.uk>).
 
5
#
 
6
#    This program is free software: you can redistribute it and/or modify
 
7
#    it under the terms of the GNU Affero General Public License as
 
8
#    published by the Free Software Foundation, either version 3 of the
 
9
#    License, or (at your option) any later version.
 
10
#
 
11
#    This program is distributed in the hope that it will be useful,
 
12
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
#    GNU Affero General Public License for more details.
 
15
#
 
16
#    You should have received a copy of the GNU Affero General Public License
 
17
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
#
 
19
##############################################################################
 
20
 
 
21
from osv import osv
 
22
from osv import fields
 
23
import datetime
 
24
from tools.translate import _
 
25
import base64
 
26
 
 
27
class ea_import_chain_result(osv.osv):
 
28
    _name='ea_import.chain.result'
 
29
    _order = 'import_time desc'
 
30
    _columns = {
 
31
        'name' : fields.char('Model', size=256, required=True),
 
32
        'chain_id': fields.many2one('ea_import.chain',),
 
33
        'result_ids_file': fields.binary('Result Ids',),
 
34
        'import_time': fields.datetime('Import Time',),
 
35
        'scheduler_log_id': fields.many2one('ea_import.scheduler.log',),
 
36
        }
 
37
 
 
38
    _defaults = {
 
39
    }
 
40
 
 
41
    def show_result(self, cr, uid, ids, context={}):
 
42
        for result in self.browse(cr, uid, ids, context=context):
 
43
            result_ids = eval(base64.b64decode(result.result_ids_file))
 
44
            return {
 
45
                'name': 'Result',
 
46
                'view_mode': 'tree,form',
 
47
                'view_type': 'form',
 
48
                'view_id': False,
 
49
                'res_model': result.name,
 
50
                'domain': [('id', 'in', result_ids)],
 
51
                'type': 'ir.actions.act_window',
 
52
                'nodestroy': True,
 
53
                'target': 'current',
 
54
            }
 
55
 
 
56
ea_import_chain_result()
 
57
 
 
58
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: