|
| 1 | +======================= |
| 2 | +Base Comments Templates |
| 3 | +======================= |
| 4 | + |
| 5 | +.. |
| 6 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 7 | + !! This file is generated by oca-gen-addon-readme !! |
| 8 | + !! changes will be overwritten. !! |
| 9 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 10 | + !! source digest: sha256:3b5eb88dbd79b1149e679ff90f3a24b61a1f07af046693635b7fc3b597479aba |
| 11 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 12 | +
|
| 13 | +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png |
| 14 | + :target: https://odoo-community.org/page/development-status |
| 15 | + :alt: Beta |
| 16 | +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png |
| 17 | + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
| 18 | + :alt: License: AGPL-3 |
| 19 | +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github |
| 20 | + :target: https://github.com/OCA/reporting-engine/tree/18.0/base_comment_template |
| 21 | + :alt: OCA/reporting-engine |
| 22 | +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png |
| 23 | + :target: https://translation.odoo-community.org/projects/reporting-engine-18-0/reporting-engine-18-0-base_comment_template |
| 24 | + :alt: Translate me on Weblate |
| 25 | +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png |
| 26 | + :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=18.0 |
| 27 | + :alt: Try me on Runboat |
| 28 | + |
| 29 | +|badge1| |badge2| |badge3| |badge4| |badge5| |
| 30 | + |
| 31 | +Add a new mixin class to define templates of comments to print on |
| 32 | +documents. The comment templates can be defined like make templates, so |
| 33 | +you can use variables from linked models. |
| 34 | + |
| 35 | +Two positions are available for the comments: |
| 36 | + |
| 37 | +- above document lines (before_lines) |
| 38 | +- below document lines (after_lines) |
| 39 | + |
| 40 | +The template are general, and can be attached to any Model and based on |
| 41 | +some domain defined in the template. You can define one default template |
| 42 | +per Model and domain, which can be overwritten for any company and |
| 43 | +partners. It has a priority field (smaller number = higher priority) |
| 44 | + |
| 45 | +In existing reports, if you add this line will get the comment template |
| 46 | +if you created one like |
| 47 | + |
| 48 | +- <span |
| 49 | + t-out="o.get_comment_template('position',company_id=o.company_id, |
| 50 | + partner_id=o.parnter_id )"/> ( or without any parameter) |
| 51 | + |
| 52 | +This module is the base module for following modules: |
| 53 | + |
| 54 | +- sale_comment_template |
| 55 | +- purchase_comment_template |
| 56 | +- account_comment_template |
| 57 | +- stock_picking_comment_template |
| 58 | + |
| 59 | +**Table of contents** |
| 60 | + |
| 61 | +.. contents:: |
| 62 | + :local: |
| 63 | + |
| 64 | +Configuration |
| 65 | +============= |
| 66 | + |
| 67 | +Go to *Settings > Technical > Reporting > Comment Templates* and start |
| 68 | +designing you comment templates. |
| 69 | + |
| 70 | +This module is the base module for following modules: |
| 71 | + |
| 72 | +- sale_comment_template |
| 73 | +- purchase_comment_template |
| 74 | +- invoice_comment_template |
| 75 | +- stock_picking_comment_template |
| 76 | + |
| 77 | +Usage |
| 78 | +===== |
| 79 | + |
| 80 | +1. Go to *Settings* and activate the developer mode. |
| 81 | +2. Go to *Settings > Technical > Reporting > Comment Templates*. |
| 82 | +3. Create a new record. |
| 83 | +4. Define the Company the template is linked or leave default for all |
| 84 | + companies. |
| 85 | +5. Define the Partner the template is linked or leave default for all |
| 86 | + partners. |
| 87 | +6. Define the Model, Domain the template is linked. |
| 88 | +7. Define the Position where the template will be printed: |
| 89 | + |
| 90 | + - above document lines |
| 91 | + - below document lines |
| 92 | + |
| 93 | +You should have at least one template with Default field set, if you |
| 94 | +choose a Partner the template is deselected as a Default one. If you |
| 95 | +create a new template with the same configuration (Model, Domain, |
| 96 | +Position) and set it as Default, the previous one will be deselected as |
| 97 | +a default one. |
| 98 | + |
| 99 | +The template is a html field which will be rendered just like a mail |
| 100 | +template, so you can use variables like {{object}}, {{user}}, {{ctx}} to |
| 101 | +add dynamic content. |
| 102 | + |
| 103 | +Change the report related to the model from configuration and add a |
| 104 | +statement like: |
| 105 | + |
| 106 | +| <t t-foreach="o.comment_template_ids.filtered(lambda x: x.position == |
| 107 | + 'before_lines')" t-as="comment_template_top"> |
| 108 | +| <div t-out="o.render_comment(comment_template_top)" /> |
| 109 | +
|
| 110 | +</t> |
| 111 | + |
| 112 | +| <t t-foreach="o.comment_template_ids.filtered(lambda x: x.position == |
| 113 | + 'after_lines')" t-as="comment_template_bottom"> |
| 114 | +| <div t-out="o.render_comment(comment_template_bottom)" /> |
| 115 | +
|
| 116 | +</t> |
| 117 | + |
| 118 | +You should always use t-if since the method returns False if no template |
| 119 | +is found. |
| 120 | + |
| 121 | +If you want to use Qweb templates, or different context, you can specify |
| 122 | +it just like in mail.render.mixin with parameters: |
| 123 | + |
| 124 | +- engine: "inline_template", "qweb" or "qweb_view", |
| 125 | +- add_context: dict with your own context, |
| 126 | +- post_process: perform a post processing on rendered result |
| 127 | + |
| 128 | +so you could use it : |
| 129 | + |
| 130 | +| <t t-foreach="o.comment_template_ids.filtered(lambda x: x.position == |
| 131 | + 'before_lines')" t-as="comment_template_top"> |
| 132 | +| <div t-out="o.render_comment(comment_template_top, engine='qweb', |
| 133 | + add_context={my dict}, postprocess=True)" /> |
| 134 | +
|
| 135 | +</t> |
| 136 | + |
| 137 | +Bug Tracker |
| 138 | +=========== |
| 139 | + |
| 140 | +Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_. |
| 141 | +In case of trouble, please check there if your issue has already been reported. |
| 142 | +If you spotted it first, help us to smash it by providing a detailed and welcomed |
| 143 | +`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20base_comment_template%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
| 144 | + |
| 145 | +Do not contact contributors directly about support or help with technical issues. |
| 146 | + |
| 147 | +Credits |
| 148 | +======= |
| 149 | + |
| 150 | +Authors |
| 151 | +------- |
| 152 | + |
| 153 | +* Camptocamp |
| 154 | + |
| 155 | +Contributors |
| 156 | +------------ |
| 157 | + |
| 158 | +- Xavier Jimenez <xavier.jimenez@qubiq.es> |
| 159 | +- Nicolas Bessi <nicolas.bessi@camptocamp.com> |
| 160 | +- Yannick Vaucher <yannick.vaucher@camptocamp.com> |
| 161 | +- Guewen Baconnier <guewen.baconnier@camptocamp.com> |
| 162 | +- Simone Rubino <simone.rubino@agilebg.com> |
| 163 | +- `DynApps <https://www.dynapps.be>`__: |
| 164 | + |
| 165 | + - Raf Ven <raf.ven@dynapps.be> |
| 166 | + |
| 167 | +- `Druidoo <https://www.druidoo.io>`__: |
| 168 | + |
| 169 | + - Iván Todorovich <ivan.todorovich@druidoo.io> |
| 170 | + |
| 171 | +- Pierre Verkest <pierreverkest84@gmail.com> |
| 172 | +- `NextERP Romania <https://www.nexterp.ro>`__: |
| 173 | + |
| 174 | + - Fekete Mihai <feketemihai@nexterp.ro> |
| 175 | + |
| 176 | +- `Tecnativa <https://www.tecnativa.com>`__: |
| 177 | + |
| 178 | + - Carlos Roca |
| 179 | + - Víctor Martínez |
| 180 | + |
| 181 | +- `Jarsa <https://www.jarsa.com>`__: |
| 182 | + |
| 183 | + - Alan Ramos <alan.ramos@jarsa.com> |
| 184 | + |
| 185 | +- `Bloopark systems <https://www.bloopark.de/>`__: |
| 186 | + |
| 187 | + - Achraf Mhadhbi <machraf@bloopark.de> |
| 188 | + |
| 189 | +Maintainers |
| 190 | +----------- |
| 191 | + |
| 192 | +This module is maintained by the OCA. |
| 193 | + |
| 194 | +.. image:: https://odoo-community.org/logo.png |
| 195 | + :alt: Odoo Community Association |
| 196 | + :target: https://odoo-community.org |
| 197 | + |
| 198 | +OCA, or the Odoo Community Association, is a nonprofit organization whose |
| 199 | +mission is to support the collaborative development of Odoo features and |
| 200 | +promote its widespread use. |
| 201 | + |
| 202 | +This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/18.0/base_comment_template>`_ project on GitHub. |
| 203 | + |
| 204 | +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
0 commit comments