OCA reporting engine fork for dev and update.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1019 B

  1. # Copyright 2014 Guewen Baconnier (Camptocamp SA)
  2. # Copyright 2013-2014 Nicolas Bessi (Camptocamp SA)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo import models, fields, api
  5. class BaseCommentTemplate(models.Model):
  6. _name = "base.comment.template"
  7. _description = "Base comment template"
  8. name = fields.Char(
  9. string='Comment summary',
  10. required=True
  11. )
  12. position = fields.Selection(
  13. selection=[
  14. ('before_lines', 'Before lines'),
  15. ('after_lines', 'After lines')
  16. ],
  17. required=True,
  18. default='before_lines',
  19. help="Position on document"
  20. )
  21. text = fields.Html(
  22. string='Comment',
  23. translate=True,
  24. required=True
  25. )
  26. @api.multi
  27. def get_value(self, partner_id=False):
  28. self.ensure_one()
  29. lang = None
  30. if partner_id:
  31. lang = self.env['res.partner'].browse(partner_id).lang
  32. return self.with_context({'lang': lang}).text