Browse Source

[IMP] base_comment_template: Improved sentences on fields

myc-14.0-py3o
Carlos Roca 3 years ago
committed by Víctor Martínez
parent
commit
8fef4ecdba
  1. 38
      base_comment_template/README.rst
  2. 135
      base_comment_template/i18n/base_comment_template.pot
  3. 181
      base_comment_template/i18n/es.po
  4. 22
      base_comment_template/models/base_comment_template.py
  5. 2
      base_comment_template/models/ir_model.py
  6. 4
      base_comment_template/readme/CONTRIBUTORS.rst
  7. 98
      base_comment_template/static/description/index.html
  8. 2
      base_comment_template/tests/test_base_comment_template.py

38
base_comment_template/README.rst

@ -13,7 +13,7 @@ Base Comments Templates
.. |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
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
:target: https://github.com/OCA/reporting-engine/tree/13.0/base_comment_template
:alt: OCA/reporting-engine
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
@ -23,7 +23,31 @@ Base Comments Templates
:target: https://runbot.odoo-community.org/runbot/143/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
|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**
@ -35,9 +59,6 @@ Configuration
Go to *Settings > Technical > Reporting > Comment Templates* and start designing you comment templates.
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 partner.
This module is the base module for following modules:
* sale_comment_template
@ -48,6 +69,7 @@ This module is the base module for following modules:
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.
@ -61,7 +83,7 @@ Usage
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 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:
@ -79,7 +101,6 @@ Change the report related to the model from configuration and add a statement li
You should always use t-if since the method returns False if no template is found.
Bug Tracker
===========
@ -118,6 +139,9 @@ Contributors
* Fekete Mihai <feketemihai@nexterp.ro>
* `Tecnativa <https://www.tecnativa.com>`_:
* Carlos Roca
Maintainers
~~~~~~~~~~~

135
base_comment_template/i18n/base_comment_template.pot

@ -4,8 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-02-09 09:55+0000\n"
"PO-Revision-Date: 2021-02-09 09:55+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -24,8 +26,8 @@ msgid "After lines"
msgstr ""
#. module: base_comment_template
#: model:ir.model,name:base_comment_template.model_base_comment_template
msgid "Base comment template"
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_form
msgid "Archived"
msgstr ""
#. module: base_comment_template
@ -34,21 +36,30 @@ msgid "Before lines"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__text
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_form
msgid "Comment"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_ir_model__is_comment_template
msgid "Comment Template"
msgstr ""
#. module: base_comment_template
#: model:ir.actions.act_window,name:base_comment_template.action_base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_res_partner__base_comment_template_ids
#: model:ir.model.fields,field_description:base_comment_template.field_res_users__base_comment_template_ids
#: model:ir.ui.menu,name:base_comment_template.reports_base_comment_template_menuitem
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_form
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_search
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_tree
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_partner_form
msgid "Comment Templates"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__name
msgid "Comment summary"
#: model:ir.model,name:base_comment_template.model_base_comment_template
msgid "Comments Template"
msgstr ""
#. module: base_comment_template
@ -56,12 +67,6 @@ msgstr ""
msgid "Company"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_res_partner__property_comment_template_id
#: model:ir.model.fields,field_description:base_comment_template.field_res_users__property_comment_template_id
msgid "Conditions template"
msgstr ""
#. module: base_comment_template
#: model:ir.model,name:base_comment_template.model_res_partner
msgid "Contact"
@ -79,24 +84,43 @@ msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__display_name
#: model:ir.model.fields,field_description:base_comment_template.field_res_partner__display_name
#: model:ir.model.fields,field_description:base_comment_template.field_comment_template__display_name
msgid "Display Name"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__domain
msgid "Filter Domain"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__id
#: model:ir.model.fields,field_description:base_comment_template.field_res_partner__id
#: model:ir.model.fields,field_description:base_comment_template.field_comment_template__id
msgid "ID"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__model_ids
msgid "IR Model"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__company_id
msgid "If set, it'll only be available for this company"
msgid ""
"If set, the comment template will be available only for the selected "
"company."
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__partner_ids
msgid ""
"If set, the comment template will be available only for the selected "
"partner."
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template____last_update
#: model:ir.model.fields,field_description:base_comment_template.field_res_partner____last_update
#: model:ir.model.fields,field_description:base_comment_template.field_comment_template____last_update
msgid "Last Modified on"
msgstr ""
@ -111,16 +135,91 @@ msgid "Last Updated on"
msgstr ""
#. module: base_comment_template
#: model:ir.model,name:base_comment_template.model_ir_model
msgid "Models"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__name
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_form
msgid "Name"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__name
msgid "Name/description of this comment template"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__partner_ids
msgid "Partner"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__position
msgid "Position"
msgid "Position on document"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__priority
msgid "Priority"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_res_partner__base_comment_template_ids
#: model:ir.model.fields,help:base_comment_template.field_res_users__base_comment_template_ids
msgid "Specific partner comments that can be included in reports"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__text
msgid "Template"
msgstr ""
#. module: base_comment_template
#: code:addons/base_comment_template/models/base_comment_template.py:0
#, python-format
msgid ""
"There are other records with same models, priority, domain and position."
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__model_ids
msgid ""
"This comment template will be available on this models. You can see here "
"only models allowed to set the coment template."
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__domain
msgid ""
"This comment template will be available only for objects that satisfy the "
"condition"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__position
msgid "Position on document"
msgid "This field allows to select the position of the comment on reports."
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__text
msgid "This is the text template that will be inserted into reports."
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_ir_model__is_comment_template
msgid "Whether this model supports in reports to add comment templates."
msgstr ""
#. module: base_comment_template
#: model:ir.model,name:base_comment_template.model_comment_template
msgid ""
"base.comment.template to put header and footer in reports based on created "
"comment templates"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__priority
msgid "the highest priority = the smallest number"
msgstr ""

181
base_comment_template/i18n/es.po

@ -8,70 +8,73 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-05 01:40+0000\n"
"PO-Revision-Date: 2018-01-05 01:40+0000\n"
"Last-Translator: enjolras <yo@miguelrevilla.com>, 2018\n"
"POT-Creation-Date: 2021-02-09 09:55+0000\n"
"PO-Revision-Date: 2021-02-09 11:21+0100\n"
"Last-Translator: Carlos <carlos.roca@tecnativa.com>\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.0.6\n"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__active
msgid "Active"
msgstr ""
msgstr "Activo"
#. module: base_comment_template
#: selection:base.comment.template,position:0
#: model:ir.model.fields.selection,name:base_comment_template.selection__base_comment_template__position__after_lines
msgid "After lines"
msgstr "Después de las líneas"
#. module: base_comment_template
#: model:ir.model,name:base_comment_template.model_base_comment_template
msgid "Base comment template"
msgstr "Plantilla de comentario base"
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_form
msgid "Archived"
msgstr "Archivado"
#. module: base_comment_template
#: selection:base.comment.template,position:0
#: model:ir.model.fields.selection,name:base_comment_template.selection__base_comment_template__position__before_lines
msgid "Before lines"
msgstr "Antes de las líneas"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__text
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_form
msgid "Comment"
msgstr "Comentario"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_ir_model__is_comment_template
msgid "Comment Template"
msgstr "Plantilla de comentario"
#. module: base_comment_template
#: model:ir.actions.act_window,name:base_comment_template.action_base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_res_partner__base_comment_template_ids
#: model:ir.model.fields,field_description:base_comment_template.field_res_users__base_comment_template_ids
#: model:ir.ui.menu,name:base_comment_template.reports_base_comment_template_menuitem
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_form
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_search
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_tree
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_partner_form
msgid "Comment Templates"
msgstr "Plantillas de comentarios"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__name
msgid "Comment summary"
msgstr "Índice de comentarios"
#: model:ir.model,name:base_comment_template.model_base_comment_template
msgid "Comments Template"
msgstr "Plantillas de comentarios"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__company_id
msgid "Company"
msgstr ""
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_res_partner__property_comment_template_id
#: model:ir.model.fields,field_description:base_comment_template.field_res_users__property_comment_template_id
#, fuzzy
msgid "Conditions template"
msgstr "Plantillas de comentarios"
msgstr "Compañía"
#. module: base_comment_template
#: model:ir.model,name:base_comment_template.model_res_partner
msgid "Contact"
msgstr ""
msgstr "Contacto"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__create_uid
@ -85,21 +88,45 @@ msgstr "Creado el"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__display_name
#: model:ir.model.fields,field_description:base_comment_template.field_comment_template__display_name
msgid "Display Name"
msgstr "Nombre mostrado"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__domain
msgid "Filter Domain"
msgstr "Filtro de dominio"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__id
#: model:ir.model.fields,field_description:base_comment_template.field_comment_template__id
msgid "ID"
msgstr "ID"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__model_ids
msgid "IR Model"
msgstr "Modelo"
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__company_id
msgid "If set, it'll only be available for this company"
msgid ""
"If set, the comment template will be available only for the selected company."
msgstr ""
"Si se define, la plantilla de comentario va a estar disponible para las "
"compañías seleccionadas."
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__partner_ids
msgid ""
"If set, the comment template will be available only for the selected partner."
msgstr ""
"Si se define, la plantilla de comentario va a estar disponible para los "
"contactos seleccionados."
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template____last_update
#: model:ir.model.fields,field_description:base_comment_template.field_comment_template____last_update
msgid "Last Modified on"
msgstr "Última modificación el"
@ -114,16 +141,112 @@ msgid "Last Updated on"
msgstr "Última modificación el"
#. module: base_comment_template
#: model:ir.model,name:base_comment_template.model_ir_model
msgid "Models"
msgstr "Modelos"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__name
#: model_terms:ir.ui.view,arch_db:base_comment_template.view_base_comment_template_form
msgid "Name"
msgstr ""
msgstr "Nombre"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__position
msgid "Position"
msgstr "Posició"
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__name
msgid "Name/description of this comment template"
msgstr "Nombre de la plantilla de comentario"
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__position
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__partner_ids
msgid "Partner"
msgstr "Contacto"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__position
msgid "Position on document"
msgstr "Posición en el documento"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__priority
msgid "Priority"
msgstr "Prioridad"
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_res_partner__base_comment_template_ids
#: model:ir.model.fields,help:base_comment_template.field_res_users__base_comment_template_ids
msgid "Specific partner comments that can be included in reports"
msgstr "Comentarios de contactos que se pueden incluir en informes"
#. module: base_comment_template
#: model:ir.model.fields,field_description:base_comment_template.field_base_comment_template__text
msgid "Template"
msgstr "Plantilla de comentario"
#. module: base_comment_template
#: code:addons/base_comment_template/models/base_comment_template.py:0
#, python-format
msgid ""
"There are other records with same models, priority, domain and position."
msgstr ""
"Hay otros registros con los mismos datos en modelo, prioridad, dominio y "
"posición."
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__model_ids
msgid ""
"This comment template will be available on this models. You can see here "
"only models allowed to set the coment template."
msgstr ""
"Esta plantilla de comentarios estará disponible en estos modelos. Sólo vas a "
"ver los modelos autorizados para configurar la plantilla de comentarios."
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__domain
msgid ""
"This comment template will be available only for objects that satisfy the "
"condition"
msgstr ""
"Esta plantilla de comentarios estará disponible solo para objetos que "
"satisfagan la condición"
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__position
msgid "This field allows to select the position of the comment on reports."
msgstr ""
"Este campo permite seleccionar la posición del comentario en los informes."
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__text
msgid "This is the text template that will be inserted into reports."
msgstr "Esta es la plantilla de texto que se insertará en los informes."
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_ir_model__is_comment_template
msgid "Whether this model supports in reports to add comment templates."
msgstr ""
"Si este modelo admite en los informes, añadir plantillas de comentarios."
#. module: base_comment_template
#: model:ir.model,name:base_comment_template.model_comment_template
msgid ""
"base.comment.template to put header and footer in reports based on created "
"comment templates"
msgstr ""
"base.comment.template para poner cabecera y pie de página en los informes "
"basados en las plantillas de comentarios creadas"
#. module: base_comment_template
#: model:ir.model.fields,help:base_comment_template.field_base_comment_template__priority
msgid "the highest priority = the smallest number"
msgstr "Mayor prioridad = número menor"
#~ msgid "Comment summary"
#~ msgstr "Índice de comentarios"
#, fuzzy
#~| msgid "Comment Templates"
#~ msgid "Conditions template"
#~ msgstr "Plantillas de comentarios"
#~ msgid "Position"
#~ msgstr "Posició"

22
base_comment_template/models/base_comment_template.py

@ -72,38 +72,39 @@ class BaseCommentTemplate(models.Model):
active = fields.Boolean(default=True)
position = fields.Selection(
string="Position on document",
selection=[("before_lines", "Before lines"), ("after_lines", "After lines")],
required=True,
default="before_lines",
help="Position on document",
help="This field allows to select the position of the comment on reports.",
)
name = fields.Char(
string="Name",
translate=True,
required=True,
help="Name/description of this mako comment template",
help="Name/description of this comment template",
)
text = fields.Html(
string="Template",
translate=True,
required=True,
sanitize=False,
help="This is the mako template that will be inserted into reports.",
help="This is the text template that will be inserted into reports.",
)
company_id = fields.Many2one(
"res.company",
string="Company",
ondelete="cascade",
index=True,
help="If set, it'll only be available for this company"
"(if the model_id has company_id)",
help="If set, the comment template will be available only for the selected "
"company.",
)
partner_ids = fields.Many2many(
comodel_name="res.partner",
string="Partner",
ondelete="cascade",
help="If set, the comment template will be available only for this "
"partner (if the model_id has a partner_id field).",
help="If set, the comment template will be available only for the selected "
"partner.",
)
model_ids = fields.Many2many(
@ -111,9 +112,8 @@ class BaseCommentTemplate(models.Model):
string="IR Model",
ondelete="cascade",
required=True,
help="This comment template will be available on this models."
"You can see here only models that have report on them "
"and have inherited comment.template",
help="This comment template will be available on this models. "
"You can see here only models allowed to set the coment template.",
)
domain = fields.Char(
@ -142,7 +142,7 @@ class BaseCommentTemplate(models.Model):
if other_template_same_models_and_priority:
raise ValidationError(
_(
"The are other records with same models, priority, "
"There are other records with same models, priority, "
"domain and position."
)
)

2
base_comment_template/models/ir_model.py

@ -10,7 +10,7 @@ class IrModel(models.Model):
is_comment_template = fields.Boolean(
string="Comment Template",
default=False,
help="Whether this model supports in reports to add " "comment templates.",
help="Whether this model supports in reports to add comment templates.",
)
def _reflect_model_params(self, model):

4
base_comment_template/readme/CONTRIBUTORS.rst

@ -15,3 +15,7 @@
* `NextERP Romania <https://www.nexterp.ro>`_:
* Fekete Mihai <feketemihai@nexterp.ro>
* `Tecnativa <https://www.tecnativa.com>`_:
* Carlos Roca

98
base_comment_template/static/description/index.html

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Base Comments Templates</title>
<style type="text/css">
@ -367,12 +367,21 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-base_comment_template"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/143/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>Add a new model to define templates of comments to print on
documents.</p>
<p>Two positions are available for the comments:
* above document lines
* below document lines</p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/13.0/base_comment_template"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/reporting-engine-13-0/reporting-engine-13-0-base_comment_template"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/143/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
<p>Two positions are available for the comments:</p>
<ul class="simple">
<li>above document lines (before_lines)</li>
<li>below document lines (after_lines)</li>
</ul>
<p>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)</p>
<p>In existing reports, if you add this line will get the comment template if you created one like</p>
<ul class="simple">
<li>&lt;span t-raw=”o.get_comment_template(‘position’,company_id=o.company_id, partner_id=o.parnter_id )”/&gt; ( or without any parameter)</li>
</ul>
<p>This module is the base module for following modules:</p>
<ul class="simple">
<li>sale_comment_template</li>
@ -383,33 +392,75 @@ documents.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p>Go to <em>Settings &gt; Technical &gt; Reporting &gt; Comment Templates</em> and start designing you comment templates.</p>
<p>This module is the base module for following modules:</p>
<ul class="simple">
<li>sale_comment_template</li>
<li>purchase_comment_template</li>
<li>invoice_comment_template</li>
<li>stock_picking_comment_template</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
<ol class="arabic simple">
<li>Go to <em>Settings</em> and activate the developer mode.</li>
<li>Go to <em>Settings &gt; Technical &gt; Reporting &gt; Comment Templates</em>.</li>
<li>Create a new record.</li>
<li>Define the Company the template is linked or leave default for all companies.</li>
<li>Define the Partner the template is linked or leave default for all partners.</li>
<li>Define the Model, Domain the template is linked.</li>
<li>Define the Position where the template will be printed:<ul>
<li>above document lines</li>
<li>below document lines</li>
</ul>
</li>
</ol>
<p>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.</p>
<p>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.</p>
<p>Change the report related to the model from configuration and add a statement like:</p>
<p>&lt;p t-if=”o.get_comment_template(‘before_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”&gt;</p>
<blockquote>
&lt;span t-raw=”o.get_comment_template(‘before_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”/&gt;</blockquote>
<p>&lt;/p&gt;</p>
<p>&lt;p t-if=”o.get_comment_template(‘after_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”&gt;</p>
<blockquote>
&lt;span t-raw=”o.get_comment_template(‘after_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”/&gt;</blockquote>
<p>&lt;/p&gt;</p>
<p>You should always use t-if since the method returns False if no template is found.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20base_comment_template%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20base_comment_template%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple">
<li>Camptocamp</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple">
<li>Xavier Jimenez &lt;<a class="reference external" href="mailto:xavier.jimenez&#64;qubiq.es">xavier.jimenez&#64;qubiq.es</a>&gt;</li>
<li>Nicolas Bessi &lt;<a class="reference external" href="mailto:nicolas.bessi&#64;camptocamp.com">nicolas.bessi&#64;camptocamp.com</a>&gt;</li>
@ -424,17 +475,24 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Iván Todorovich &lt;<a class="reference external" href="mailto:ivan.todorovich&#64;druidoo.io">ivan.todorovich&#64;druidoo.io</a>&gt;</li>
</ul>
</li>
<li>Pierre Verkest &lt;<a class="reference external" href="mailto:pierreverkest84&#64;gmail.com">pierreverkest84&#64;gmail.com</a>&gt;</li>
<li><a class="reference external" href="https://www.nexterp.ro">NextERP Romania</a>:<ul>
<li>Fekete Mihai &lt;<a class="reference external" href="mailto:feketemihai&#64;nexterp.ro">feketemihai&#64;nexterp.ro</a>&gt;</li>
</ul>
</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Carlos Roca</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/14.0/base_comment_template">OCA/reporting-engine</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/13.0/base_comment_template">OCA/reporting-engine</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

2
base_comment_template/tests/test_base_comment_template.py

@ -142,7 +142,7 @@ class TestCommentTemplate(common.SavepointCase):
}
)
self.assertTrue(
"The are other records with same models, priority, domain and position."
"There are other records with same models, priority, domain and position."
== context.exception.args[0]
)

Loading…
Cancel
Save