Migrate res_users.py to new API

This commit is contained in:
Guewen Baconnier
2014-11-14 10:57:06 +01:00
parent 435c7b7860
commit 03570cbc0e

View File

@@ -5,8 +5,7 @@
# Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com> # Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com>
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) # Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) # Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
# Copyright (C) 2013 Camptocamp (<http://www.camptocamp.com>) # Copyright (C) 2013-2014 Camptocamp (<http://www.camptocamp.com>)
# All Rights Reserved
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published # it under the terms of the GNU Affero General Public License as published
@@ -22,27 +21,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
from openerp.osv import orm, fields from openerp import models, fields
from printing import _available_action_types from .printing import _available_action_types
class res_users(orm.Model): class res_users(models.Model):
""" """
Users Users
""" """
_name = "res.users" _name = 'res.users'
_inherit = "res.users" _inherit = 'res.users'
def _user_available_action_types(self, cr, uid, context=None): def _user_available_action_types(self):
if context is None: return [(code, string) for code, string
context = {} in _available_action_types(self)
return [x for x in _available_action_types(self, cr, uid, context) if code != 'user_default']
if x[0] != 'user_default']
_columns = { printing_action = fields.Selection(_user_available_action_types)
'printing_action': fields.selection(_user_available_action_types, 'Printing Action'), printing_printer_id = fields.Many2one(comodel_name='printing.printer',
'printing_printer_id': fields.many2one('printing.printer', 'Default Printer'), string='Default Printer')
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: