From 03570cbc0eaffe7b2f8a970ecb7f9ea0e681c583 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Fri, 14 Nov 2014 10:57:06 +0100 Subject: [PATCH] Migrate res_users.py to new API --- base_report_to_printer/users.py | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/base_report_to_printer/users.py b/base_report_to_printer/users.py index 1aa546e..b546bc3 100644 --- a/base_report_to_printer/users.py +++ b/base_report_to_printer/users.py @@ -5,8 +5,7 @@ # Copyright (c) 2009 Albert Cervera i Areny # Copyright (C) 2011 Agile Business Group sagl () # Copyright (C) 2011 Domsense srl () -# Copyright (C) 2013 Camptocamp () -# All Rights Reserved +# Copyright (C) 2013-2014 Camptocamp () # # 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 @@ -22,27 +21,23 @@ # along with this program. If not, see . # ############################################################################## -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 """ - _name = "res.users" - _inherit = "res.users" + _name = 'res.users' + _inherit = 'res.users' - def _user_available_action_types(self, cr, uid, context=None): - if context is None: - context = {} - return [x for x in _available_action_types(self, cr, uid, context) - if x[0] != 'user_default'] + def _user_available_action_types(self): + return [(code, string) for code, string + in _available_action_types(self) + if code != 'user_default'] - _columns = { - 'printing_action': fields.selection(_user_available_action_types, 'Printing Action'), - 'printing_printer_id': fields.many2one('printing.printer', 'Default Printer'), - } - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + printing_action = fields.Selection(_user_available_action_types) + printing_printer_id = fields.Many2one(comodel_name='printing.printer', + string='Default Printer')