diff --git a/base_comment_template/README.rst b/base_comment_template/README.rst index edc149ed..11871f63 100644 --- a/base_comment_template/README.rst +++ b/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 + +* ( 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 +* `Tecnativa `_: + + * Carlos Roca Maintainers ~~~~~~~~~~~ diff --git a/base_comment_template/i18n/base_comment_template.pot b/base_comment_template/i18n/base_comment_template.pot index 649f377d..cf594bd3 100644 --- a/base_comment_template/i18n/base_comment_template.pot +++ b/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 "" diff --git a/base_comment_template/i18n/es.po b/base_comment_template/i18n/es.po index 682c1f06..e5d06266 100644 --- a/base_comment_template/i18n/es.po +++ b/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 , 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 \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ó" diff --git a/base_comment_template/models/base_comment_template.py b/base_comment_template/models/base_comment_template.py index 489d7353..33e98581 100644 --- a/base_comment_template/models/base_comment_template.py +++ b/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." ) ) diff --git a/base_comment_template/models/ir_model.py b/base_comment_template/models/ir_model.py index 49150a11..b799732b 100644 --- a/base_comment_template/models/ir_model.py +++ b/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): diff --git a/base_comment_template/readme/CONTRIBUTORS.rst b/base_comment_template/readme/CONTRIBUTORS.rst index 7d6d8d13..8a42546c 100644 --- a/base_comment_template/readme/CONTRIBUTORS.rst +++ b/base_comment_template/readme/CONTRIBUTORS.rst @@ -15,3 +15,7 @@ * `NextERP Romania `_: * Fekete Mihai + +* `Tecnativa `_: + + * Carlos Roca diff --git a/base_comment_template/static/description/index.html b/base_comment_template/static/description/index.html index 354d7e20..886c2013 100644 --- a/base_comment_template/static/description/index.html +++ b/base_comment_template/static/description/index.html @@ -3,7 +3,7 @@ - + Base Comments Templates