From e8b603793fc9cb81333f8fff08c4c4d75f9afdca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Thu, 8 Apr 2021 14:34:41 +0200 Subject: [PATCH] [IMP] base_comment_template: Add function to get_comment_template records --- .../models/base_comment_template.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/base_comment_template/models/base_comment_template.py b/base_comment_template/models/base_comment_template.py index 33e98581..721e4e0f 100644 --- a/base_comment_template/models/base_comment_template.py +++ b/base_comment_template/models/base_comment_template.py @@ -16,12 +16,9 @@ class CommentTemplate(models.AbstractModel): "in reports based on created comment templates" ) - def get_comment_template( + def get_comment_template_records( self, position="before_lines", company_id=False, partner_id=False ): - """ Method that is called from report xml and is returning the - position template as a html if exists - """ self.ensure_one() if not company_id: company_id = self.env.company.id @@ -51,6 +48,18 @@ class CommentTemplate(models.AbstractModel): ) if lang: templates = templates.with_context({"lang": lang}) + return templates + + def get_comment_template( + self, position="before_lines", company_id=False, partner_id=False + ): + """ Method that is called from report xml and is returning the + position template as a html if exists + """ + self.ensure_one() + templates = self.get_comment_template_records( + position=position, company_id=company_id, partner_id=partner_id + ) template = False if templates: for templ in templates: