Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][MIG] base_comment_template: Migration to 15.0 #646

Merged
merged 41 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4dd0f9d
Rename base_condition_template to base_comment_template
guewen Dec 8, 2014
6faca5e
[MIG] base_comment_template to 9.0
Aug 24, 2016
627ef24
[MIG] base_comment_template, invoice_comment_template: Migration to 10.0
clb-openfire Jun 19, 2017
c7cc022
[MIG] base_comment_template: Migration to 11.0
xavierjimenez Jul 30, 2018
f946198
[MIG] base_comment_template: Migration to 12.0
rven Dec 26, 2018
8f98051
Translated using Weblate (Galician)
mvrodriguez Feb 6, 2019
d0933f9
Translated using Weblate (Japanese)
yostashiro Jul 5, 2019
0d21dd0
Translated using Weblate (Portuguese)
pedrocs-exo Aug 17, 2019
0bf0ea9
Translated using Weblate (Portuguese (Brazil))
Sep 17, 2019
1f665aa
[IMP] base_comment_template multi company rules
Apr 19, 2019
d703ca7
[IMP] account_invoice_comment_template: Move comment_template_id fiel…
Apr 19, 2019
c591d13
[MOV] migration script to base_comment_template
Apr 23, 2019
6d6dd3d
Translated using Weblate (Portuguese (Brazil))
Nov 24, 2019
023cf3e
Translated using Weblate (Portuguese)
pedrocs-exo Feb 29, 2020
f67f8bb
Translated using Weblate (Croatian)
badbole Mar 5, 2020
78d335f
[FIX] base_comment_template: Make field truly company dependent
pedrobaeza Mar 12, 2020
04826fb
[FIX] base_comment_template: Make field truly company dependent
pedrobaeza Mar 12, 2020
903c88b
Translated using Weblate (German)
marylla Mar 23, 2020
7f8d5b5
Translated using Weblate (Portuguese (Portugal))
pedrocs-exo Mar 23, 2020
a3954d1
Translated using Weblate (Slovak)
jprokop1 Jul 4, 2020
f43d655
[MIG+FIX] base_comment_template: Fix migration scripts
pedrobaeza Nov 13, 2020
744563b
[IMP] base_comment_template: black, isort, prettier
petrus-v Jan 7, 2021
6570eb6
[MIG] base_comment_template: Migration to 14.0 add unit test
petrus-v Jan 8, 2021
a68181d
[MIG] [13.0] Migrate base_comment_template from account_invoic_report…
feketemihai Jul 8, 2020
d20a4fe
[IMP] base_comment_template: Code refactorization
Oct 4, 2020
5d01d63
[IMP] base_comment_template: Improved sentences on fields
CarlosRoca13 Feb 9, 2021
d5be3ca
[IMP] base_comment_template: Add function to get_comment_template rec…
victoralmau Apr 8, 2021
f66698a
[FIX] base_comment_template: Fix tests: test_company_general_template
victoralmau Apr 12, 2021
ce15465
[FIX] base_comment_template: Change domain in rule according to company
victoralmau Apr 19, 2021
c646ae8
[IMP] base_comment_template: Refactor code and convert to Many2Many
victoralmau Apr 22, 2021
8fdbcaf
[FIX] base_comment_template: Incorrect m2m column names + script + av…
pedrobaeza May 15, 2021
9a366d7
[IMP] base_comment_template: Adapt to 14.0
victoralmau Apr 13, 2021
724fb2d
[FIX] base_comment_template: Filter domain correctly
joao-p-marques May 25, 2021
8c2f189
[FIX] base_comment_template: Delete res_partner.xml view (not used now)
victoralmau May 25, 2021
4a412dc
Translated using Weblate (Portuguese)
pedrocs-exo Jul 1, 2021
452b4ca
Translated using Weblate (Italian)
francesco-ooops May 9, 2022
153dabf
[14.0] [FIX] Fix base comment template rendering.
feketemihai Jan 10, 2022
a50df16
[FIX] base_comment_template: Typo error
etobella Jun 7, 2022
a348edf
[IMP] base_comment_template: black, isort, prettier
victoralmau Sep 13, 2022
3b50a7a
[MIG] base_comment_template: Migration to 15.0
alan196 Apr 26, 2022
13b6017
[MIG] base_comment_template: Migration to 15.0
victoralmau Sep 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions base_comment_template/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
=======================
Base Comments Templates
=======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
: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/15.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-15-0/reporting-engine-15-0-base_comment_template
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/143/15.0
:alt: Try me on Runbot

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

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-raw="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
* invoice_comment_template
* stock_picking_comment_template

**Table of contents**

.. contents::
:local:

Configuration
=============

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

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:

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

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:

<t t-foreach="o.comment_template_ids.filtered(lambda x: x.position == 'before_lines')" t-as="comment_template_top">
<div t-raw="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-raw="o.render_comment(comment_template_bottom)" />

</t>

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:

- 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-raw="o.render_comment(comment_template_top, engine='qweb', add_context={my dict}, postprocess=True)" />

</t>

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20base_comment_template%0Aversion:%2015.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>`_:

* 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]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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/15.0/base_comment_template>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions base_comment_template/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
from . import wizard
22 changes: 22 additions & 0 deletions base_comment_template/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# © 2013-2014 Nicolas Bessi (Camptocamp SA)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Base Comments Templates",
"summary": "Add conditional mako template to any report"
"on models that inherits comment.template.",
"version": "15.0.1.0.0",
"category": "Reporting",
"website": "https://github.com/OCA/reporting-engine",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["base", "mail"],
"data": [
"security/ir.model.access.csv",
"security/security.xml",
"wizard/base_comment_template_preview_views.xml",
"views/base_comment_template_view.xml",
"views/res_partner_view.xml",
],
}
Loading