From 4a4a015be5515f8b9a686db45069e6650e526a20 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Mon, 17 Nov 2014 14:18:29 +0100 Subject: [PATCH] new api for 'printing.report.xml.action' --- printer_tray/report_xml_action.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/printer_tray/report_xml_action.py b/printer_tray/report_xml_action.py index 603e21b..0e29524 100644 --- a/printer_tray/report_xml_action.py +++ b/printer_tray/report_xml_action.py @@ -19,20 +19,21 @@ # ############################################################################## -from openerp.osv import orm, fields +from openerp import models, fields, api -class ReportXMLAction(orm.Model): +class ReportXMLAction(models.Model): _inherit = 'printing.report.xml.action' - _columns = { - 'printer_tray_id': fields.many2one( - 'printing.tray', 'Paper Source', - domain="[('printer_id', '=', printer_id)]"), - } + printer_tray_id = fields.Many2one( + comodel_name='printing.tray', + string='Paper Source', + domain="[('printer_id', '=', printer_id)]", + ) - def behaviour(self, cr, uid, act_id, context=None): - res = super(ReportXMLAction, self).behaviour(cr, uid, act_id, context=context) - action = self.browse(cr, uid, act_id, context=context) - res['tray'] = action.printer_tray_id.system_name + @api.multi + def behaviour(self): + self.ensure_one() + res = super(ReportXMLAction, self).behaviour() + res['tray'] = self.printer_tray_id.system_name return res