|
@@ -1,5 +1,5 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
-from openerp import models, fields
|
|
|
+from openerp import api, models, fields
|
|
|
|
|
|
AVAILABLE_PROTOCOLS = [
|
|
|
('ws', 'ws (WebSocket)'),
|
|
@@ -11,6 +11,10 @@ AVAILABLE_PROTOCOLS = [
|
|
|
class PrintEngineSocket(models.Model):
|
|
|
_name = 'print.engine.socket'
|
|
|
|
|
|
+ @api.multi
|
|
|
+ def _default_user(self):
|
|
|
+ return self.env.user.id
|
|
|
+
|
|
|
name = fields.Char(string='Nombre', size=35, required=True)
|
|
|
protocol = fields.Selection(string='Protocolo', selection=AVAILABLE_PROTOCOLS, default='ws')
|
|
|
host = fields.Char(string='Host', default='127.0.0.1', required=True)
|
|
@@ -18,5 +22,5 @@ class PrintEngineSocket(models.Model):
|
|
|
path = fields.Char(string='Recurso', default='/')
|
|
|
last_connection = fields.Datetime(string='Última conexión', readonly=True)
|
|
|
active = fields.Boolean(string='Activo', default=True)
|
|
|
- user_id = fields.Many2one(comodel_name='res.users')
|
|
|
+ user_id = fields.Many2one(comodel_name='res.users', default=_default_user)
|
|
|
printer_ids = fields.One2many(comodel_name='print.engine.printer', inverse_name='socket_id')
|