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.

31 lines
1.5 KiB

  1. #. Go to *Settings* and activate the developer mode.
  2. #. Go to *Settings > Technical > Reporting > Comment Templates*.
  3. #. Create a new record.
  4. #. Define the Company the template is linked or leave default for all companies.
  5. #. Define the Partner the template is linked or leave default for all partners.
  6. #. Define the Model, Domain the template is linked.
  7. #. Define the Position where the template will be printed:
  8. * above document lines
  9. * below document lines
  10. You should have at least one template with Default field set, if you choose a Partner the template is deselected as a Default one.
  11. If you create a new template with the same configuration (Model, Domain, Position) and set it as Default, the previous one will be deselected as a default one.
  12. The template is a html field which will be rendered just like a mail template, so you can use variables like ${object}, ${user}, ${ctx} to add dynamic content.
  13. Change the report related to the model from configuration and add a statement like:
  14. <p t-if="o.get_comment_template('before_lines', o.company_id.id, o.partner_id and o.partner_id.id or False)">
  15. <span t-raw="o.get_comment_template('before_lines', o.company_id.id, o.partner_id and o.partner_id.id or False)"/>
  16. </p>
  17. <p t-if="o.get_comment_template('after_lines', o.company_id.id, o.partner_id and o.partner_id.id or False)">
  18. <span t-raw="o.get_comment_template('after_lines', o.company_id.id, o.partner_id and o.partner_id.id or False)"/>
  19. </p>
  20. You should always use t-if since the method returns False if no template is found.