|
|
@ -5,17 +5,17 @@ from odoo.osv.expression import normalize_domain, AND |
|
|
|
class SurveySurvey(models.Model): |
|
|
|
_inherit = 'survey.survey' |
|
|
|
|
|
|
|
tot_sent_start_survey = fields.Integer("Started sent input count", compute="_count_sent_input") |
|
|
|
tot_sent_comp_survey = fields.Integer("Completed sent input count", compute="_count_sent_input") |
|
|
|
sent_start_ratio = fields.Integer(string="Started sent input ratio", compute="_get_sent_start_ratio") |
|
|
|
sent_comp_ratio = fields.Integer(string="Completed sent input ratio", compute="_get_sent_comp_ratio") |
|
|
|
tot_sent_start_survey = fields.Integer("Started sent survey count", compute="_count_sent_input") |
|
|
|
tot_sent_comp_survey = fields.Integer("Completed sent survey count", compute="_count_sent_input") |
|
|
|
sent_start_ratio = fields.Integer(string="Started sent survey ratio", compute="_get_sent_start_ratio") |
|
|
|
sent_comp_ratio = fields.Integer(string="Completed sent survey ratio", compute="_get_sent_comp_ratio") |
|
|
|
|
|
|
|
# COMPUTES |
|
|
|
|
|
|
|
@api.multi |
|
|
|
def _count_sent_input(self): |
|
|
|
UserInput = self.env['survey.user_input'] |
|
|
|
sent_start_survey = UserInput.search([('survey_id', 'in', self.ids), ('type', '=', 'link'), ('state', '=', 'skip'), ('state', '=', 'done')]) |
|
|
|
sent_start_survey = UserInput.search([('survey_id', 'in', self.ids), ('type', '=', 'link'), ('state', '=', 'skip')]) |
|
|
|
sent_comp_survey = UserInput.search([('survey_id', 'in', self.ids), ('type', '=', 'link'), ('state', '=', 'done')]) |
|
|
|
for survey in self: |
|
|
|
survey.tot_sent_start_survey = len(sent_start_survey.filtered(lambda user_input: user_input.survey_id == survey)) |
|
|
|