Browse Source

[IMP] base_comment_template: Add function to get_comment_template records

myc-14.0-py3o
Víctor Martínez 4 years ago
parent
commit
e8b603793f
  1. 17
      base_comment_template/models/base_comment_template.py

17
base_comment_template/models/base_comment_template.py

@ -16,12 +16,9 @@ class CommentTemplate(models.AbstractModel):
"in reports based on created comment templates" "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 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() self.ensure_one()
if not company_id: if not company_id:
company_id = self.env.company.id company_id = self.env.company.id
@ -51,6 +48,18 @@ class CommentTemplate(models.AbstractModel):
) )
if lang: if lang:
templates = templates.with_context({"lang": 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 template = False
if templates: if templates:
for templ in templates: for templ in templates:

Loading…
Cancel
Save