-
-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathsurvey_survey.py
More file actions
48 lines (42 loc) · 1.43 KB
/
survey_survey.py
File metadata and controls
48 lines (42 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright 2025 Binhex
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class SurveySurvey(models.Model):
_inherit = "survey.survey"
title = fields.Char(size=180)
certification_company_name = fields.Char(
"Certification - Company Name",
help=(
"Company name to be used in the certification report. "
"If left blank, the company name will be used."
),
compute="_compute_certification_branding_fields",
store=True,
size=100,
readonly=False,
)
certification_logo_512 = fields.Image(
string="Certification - Logo",
max_width=512,
max_height=512,
help=(
"Logo to be used in the certification report. "
"It will be resized to a maximum of 512x512 pixels. "
"If left blank, the company logo will be used."
),
compute="_compute_certification_branding_fields",
store=True,
readonly=False,
)
@api.depends("certification")
def _compute_certification_branding_fields(self):
"""
Clear the certification branding fields if the survey is not a
certification
"""
self.filtered(lambda survey: not survey.certification).update(
{
"certification_company_name": False,
"certification_logo_512": False,
}
)