Skip to content

Commit

Permalink
[IMP] base_comment_template: pre-commit auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alan196 committed May 3, 2024
1 parent e1e49f8 commit 7234782
Show file tree
Hide file tree
Showing 11 changed files with 257 additions and 213 deletions.
161 changes: 89 additions & 72 deletions base_comment_template/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,44 @@ Base Comments Templates
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
:target: https://github.com/OCA/reporting-engine/tree/16.0/base_comment_template
:target: https://github.com/OCA/reporting-engine/tree/17.0/base_comment_template
:alt: OCA/reporting-engine
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-base_comment_template
:target: https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-base_comment_template
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Add a new mixin class to define templates of comments to print on documents.
The comment templates can be defined like make templates, so you can use variables from linked models.
Add a new mixin class to define templates of comments to print on
documents. The comment templates can be defined like make templates, so
you can use variables from linked models.

Two positions are available for the comments:

* above document lines (before_lines)
* below document lines (after_lines)
- above document lines (before_lines)
- below document lines (after_lines)

The template are general, and can be attached to any Model and based on some domain defined in the template.
You can define one default template per Model and domain, which can be overwritten for any company and partners.
It has a priority field (smaller number = higher priority)
The template are general, and can be attached to any Model and based on
some domain defined in the template. You can define one default template
per Model and domain, which can be overwritten for any company and
partners. It has a priority field (smaller number = higher priority)

In existing reports, if you add this line will get the comment template if you created one like

* <span t-out="o.get_comment_template('position',company_id=o.company_id, partner_id=o.parnter_id )"/> ( or without any parameter)
In existing reports, if you add this line will get the comment template
if you created one like

- <span
t-out="o.get_comment_template('position',company_id=o.company_id,
partner_id=o.parnter_id )"/> ( or without any parameter)

This module is the base module for following modules:

* sale_comment_template
* purchase_comment_template
* account_comment_template
* stock_picking_comment_template
- sale_comment_template
- purchase_comment_template
- account_comment_template
- stock_picking_comment_template

**Table of contents**

Expand All @@ -60,60 +64,73 @@ This module is the base module for following modules:
Configuration
=============

Go to *Settings > Technical > Reporting > Comment Templates* and start designing you comment templates.
Go to *Settings > Technical > Reporting > Comment Templates* and start
designing you comment templates.

This module is the base module for following modules:

* sale_comment_template
* purchase_comment_template
* invoice_comment_template
* stock_picking_comment_template
- sale_comment_template
- purchase_comment_template
- invoice_comment_template
- stock_picking_comment_template

Usage
=====

#. Go to *Settings* and activate the developer mode.
#. Go to *Settings > Technical > Reporting > Comment Templates*.
#. Create a new record.
#. Define the Company the template is linked or leave default for all companies.
#. Define the Partner the template is linked or leave default for all partners.
#. Define the Model, Domain the template is linked.
#. Define the Position where the template will be printed:
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:

* above document lines
* below document lines
- above document lines
- below document lines

You should have at least one template with Default field set, if you choose a Partner the template is deselected as a Default one.
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.
You should have at least one template with Default field set, if you
choose a Partner the template is deselected as a Default one. 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.

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.
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.

Change the report related to the model from configuration and add a statement like:
Change the report related to the model from configuration and add a
statement like:

<t t-foreach="o.comment_template_ids.filtered(lambda x: x.position == 'before_lines')" t-as="comment_template_top">
<div t-out="o.render_comment(comment_template_top)" />
| <t t-foreach="o.comment_template_ids.filtered(lambda x: x.position ==
'before_lines')" t-as="comment_template_top">
| <div t-out="o.render_comment(comment_template_top)" />
</t>


<t t-foreach="o.comment_template_ids.filtered(lambda x: x.position == 'after_lines')" t-as="comment_template_bottom">
<div t-out="o.render_comment(comment_template_bottom)" />
| <t t-foreach="o.comment_template_ids.filtered(lambda x: x.position ==
'after_lines')" t-as="comment_template_bottom">
| <div t-out="o.render_comment(comment_template_bottom)" />
</t>

You should always use t-if since the method returns False if no template is found.
You should always use t-if since the method returns False if no template
is found.

If you want to use Qweb templates, or different context, you can specify it just like in
mail.render.mixin with parameters:
If you want to use Qweb templates, or different context, you can specify
it just like in mail.render.mixin with parameters:

- engine: "inline_template", "qweb" or "qweb_view",
- add_context: dict with your own context,
- post_process: perform a post processing on rendered result
- engine: "inline_template", "qweb" or "qweb_view",
- add_context: dict with your own context,
- post_process: perform a post processing on rendered result

so you could use it :

<t t-foreach="o.comment_template_ids.filtered(lambda x: x.position == 'before_lines')" t-as="comment_template_top">
<div t-out="o.render_comment(comment_template_top, engine='qweb', add_context={my dict}, postprocess=True)" />
| <t t-foreach="o.comment_template_ids.filtered(lambda x: x.position ==
'before_lines')" t-as="comment_template_top">
| <div t-out="o.render_comment(comment_template_top, engine='qweb',
add_context={my dict}, postprocess=True)" />
</t>

Expand All @@ -123,54 +140,54 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20base_comment_template%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20base_comment_template%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~
-------

* Camptocamp

Contributors
~~~~~~~~~~~~
------------

* Xavier Jimenez <[email protected]>
* Nicolas Bessi <[email protected]>
* Yannick Vaucher <[email protected]>
* Guewen Baconnier <[email protected]>
* Simone Rubino <[email protected]>
* `DynApps <https://www.dynapps.be>`_:
- Xavier Jimenez <[email protected]>
- Nicolas Bessi <[email protected]>
- Yannick Vaucher <[email protected]>
- Guewen Baconnier <[email protected]>
- Simone Rubino <[email protected]>
- `DynApps <https://www.dynapps.be>`__:

* Raf Ven <[email protected]>
- Raf Ven <[email protected]>

* `Druidoo <https://www.druidoo.io>`_:
- `Druidoo <https://www.druidoo.io>`__:

* Iván Todorovich <[email protected]>
* Pierre Verkest <[email protected]>
- Iván Todorovich <[email protected]>

* `NextERP Romania <https://www.nexterp.ro>`_:
- Pierre Verkest <[email protected]>
- `NextERP Romania <https://www.nexterp.ro>`__:

* Fekete Mihai <[email protected]>
- Fekete Mihai <[email protected]>

* `Tecnativa <https://www.tecnativa.com>`_:
- `Tecnativa <https://www.tecnativa.com>`__:

* Carlos Roca
* Víctor Martínez
- Carlos Roca
- Víctor Martínez

* `Jarsa <https://www.jarsa.com>`_:
- `Jarsa <https://www.jarsa.com>`__:

* Alan Ramos <[email protected]>
- Alan Ramos <[email protected]>

* `Bloopark systems <https://www.bloopark.de/>`_:
- `Bloopark systems <https://www.bloopark.de/>`__:

* Achraf Mhadhbi <[email protected]>
- Achraf Mhadhbi <[email protected]>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -182,6 +199,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/16.0/base_comment_template>`_ project on GitHub.
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/17.0/base_comment_template>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions base_comment_template/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
9 changes: 9 additions & 0 deletions base_comment_template/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Go to *Settings \> Technical \> Reporting \> Comment Templates* and
start designing you comment templates.

This module is the base module for following modules:

- sale_comment_template
- purchase_comment_template
- invoice_comment_template
- stock_picking_comment_template
8 changes: 0 additions & 8 deletions base_comment_template/readme/CONFIGURE.rst

This file was deleted.

19 changes: 19 additions & 0 deletions base_comment_template/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- Xavier Jimenez \<<[email protected]>\>
- Nicolas Bessi \<<[email protected]>\>
- Yannick Vaucher \<<[email protected]>\>
- Guewen Baconnier \<<[email protected]>\>
- Simone Rubino \<<[email protected]>\>
- [DynApps](https://www.dynapps.be):
- Raf Ven \<<[email protected]>\>
- [Druidoo](https://www.druidoo.io):
- Iván Todorovich \<<[email protected]>\>
- Pierre Verkest \<<[email protected]>\>
- [NextERP Romania](https://www.nexterp.ro):
- Fekete Mihai \<<[email protected]>\>
- [Tecnativa](https://www.tecnativa.com):
- Carlos Roca
- Víctor Martínez
- [Jarsa](https://www.jarsa.com):
- Alan Ramos \<<[email protected]>\>
- [Bloopark systems](https://www.bloopark.de/):
- Achraf Mhadhbi \<<[email protected]>\>
30 changes: 0 additions & 30 deletions base_comment_template/readme/CONTRIBUTORS.rst

This file was deleted.

27 changes: 27 additions & 0 deletions base_comment_template/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Add a new mixin class to define templates of comments to print on
documents. The comment templates can be defined like make templates, so
you can use variables from linked models.

Two positions are available for the comments:

- above document lines (before_lines)
- below document lines (after_lines)

The template are general, and can be attached to any Model and based on
some domain defined in the template. You can define one default template
per Model and domain, which can be overwritten for any company and
partners. It has a priority field (smaller number = higher priority)

In existing reports, if you add this line will get the comment template
if you created one like

- \<span
t-out="o.get_comment_template('position',company_id=o.company_id,
partner_id=o.parnter_id )"/\> ( or without any parameter)

This module is the base module for following modules:

- sale_comment_template
- purchase_comment_template
- account_comment_template
- stock_picking_comment_template
23 changes: 0 additions & 23 deletions base_comment_template/readme/DESCRIPTION.rst

This file was deleted.

Loading

0 comments on commit 7234782

Please sign in to comment.