[MIG] base_comment_template to 9.0

This commit is contained in:
leNeo
2016-08-24 18:53:04 +02:00
committed by Pierre Verkest
parent 91aaae6536
commit 0e95b7b6bc
6 changed files with 45 additions and 49 deletions

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import comment

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# © 2013-2014 Nicolas Bessi (Camptocamp SA)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api
class BaseCommentTemplate(models.Model):
_name = "base.comment.template"
_description = "Base comment template"
name = fields.Char('Comment summary', required=True)
position = fields.Selection([('before_lines', 'Before lines'),
('after_lines', 'After lines')],
'Position',
required=True,
default='before_lines',
help="Position on document")
text = fields.Html('Comment', translate=True, required=True)
@api.multi
def get_value(self, partner_id=False):
self.ensure_one()
lang = None
if partner_id:
lang = self.env['res.partner'].browse(partner_id).lang
return self.with_context({'lang': lang}).text