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.

48 lines
1.2 KiB

  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 fields, models
  5. class BaseCommentTemplate(models.Model):
  6. _name = "base.comment.template"
  7. _description = "Base comment template"
  8. active = fields.Boolean(default=True)
  9. name = fields.Char(
  10. string="Comment summary",
  11. required=True,
  12. )
  13. position = fields.Selection(
  14. selection=[
  15. ("before_lines", "Before lines"),
  16. ("after_lines", "After lines"),
  17. ],
  18. required=True,
  19. default="before_lines",
  20. help="Position on document",
  21. )
  22. text = fields.Html(
  23. string="Comment",
  24. translate=True,
  25. required=True,
  26. )
  27. company_id = fields.Many2one(
  28. "res.company",
  29. string="Company",
  30. help="If set, it'll only be available for this company",
  31. ondelete="cascade",
  32. index=True,
  33. )
  34. def get_value(self, partner_id=False):
  35. self.ensure_one()
  36. lang = None
  37. if partner_id:
  38. lang = self.env["res.partner"].browse(partner_id).lang
  39. return self.with_context(lang=lang).text