mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
Migrate report_xml_action.py to new API
This commit is contained in:
committed by
Sylvain GARANCHER
parent
200527387c
commit
fe3ab51f5a
@@ -22,29 +22,32 @@
|
|||||||
# 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, api
|
||||||
|
|
||||||
from printing import _available_action_types
|
from .printing import _available_action_types
|
||||||
|
|
||||||
class report_xml_action(orm.Model):
|
|
||||||
|
class ReportXmlAction(models.Model):
|
||||||
_name = 'printing.report.xml.action'
|
_name = 'printing.report.xml.action'
|
||||||
_description = 'Report Printing Actions'
|
_description = 'Report Printing Actions'
|
||||||
_columns = {
|
|
||||||
'report_id': fields.many2one('ir.actions.report.xml', 'Report', required=True, ondelete='cascade'),
|
|
||||||
'user_id': fields.many2one('res.users', 'User', required=True, ondelete='cascade'),
|
|
||||||
'action': fields.selection(_available_action_types, 'Action', required=True),
|
|
||||||
'printer_id': fields.many2one('printing.printer', 'Printer'),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
report_id = fields.Many2one(comodel_name='ir.actions.report.xml',
|
||||||
|
string='Report',
|
||||||
|
required=True,
|
||||||
|
ondelete='cascade')
|
||||||
|
user_id = fields.Many2one(comodel_name='res.users',
|
||||||
|
string='User',
|
||||||
|
required=True,
|
||||||
|
ondelete='cascade')
|
||||||
|
action = fields.Selection(_available_action_types,
|
||||||
|
required=True)
|
||||||
|
printer_id = fields.Many2one(comodel_name='printing.printer',
|
||||||
|
string='Printer')
|
||||||
|
|
||||||
def behaviour(self, cr, uid, act_id, context=None):
|
@api.multi
|
||||||
result = {}
|
def behaviour(self):
|
||||||
if not act_id:
|
if not self:
|
||||||
return False
|
return {}
|
||||||
action = self.browse(cr, uid, act_id, context=context)
|
return {'action': self.action,
|
||||||
return {
|
'printer': self.printer_id,
|
||||||
'action': action.action,
|
}
|
||||||
'printer': action.printer_id,
|
|
||||||
}
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
||||||
|
|||||||
Reference in New Issue
Block a user