diff --git a/survey_input_statistics/__manifest__.py b/survey_input_statistics/__manifest__.py index d0af39e..1aa3995 100644 --- a/survey_input_statistics/__manifest__.py +++ b/survey_input_statistics/__manifest__.py @@ -30,6 +30,7 @@ ], "data": [ "views/survey_survey.xml", + "views/survey_user_input.xml", ], "css": [], "images": [], diff --git a/survey_input_statistics/models/survey_survey.py b/survey_input_statistics/models/survey_survey.py index 4393d9b..89290d3 100644 --- a/survey_input_statistics/models/survey_survey.py +++ b/survey_input_statistics/models/survey_survey.py @@ -27,7 +27,10 @@ class SurveySurvey(models.Model): } stat = dict((sid, default_vals) for sid in self.ids) UserInput = self.env["survey.user_input"] - base_domain = [("survey_id", "in", self.ids)] + base_domain = [ + ("survey_id", "in", self.ids), + ("invite_token", "!=", False), + ] read_group_res = UserInput._read_group( base_domain, @@ -78,23 +81,15 @@ class SurveySurvey(models.Model): ctx = dict(self.env.context) search_done = ctx.get("search_default_completed", None) action = super(SurveySurvey, self).action_survey_user_input() - if ctx.get("shared_only", False): - domain = action.get("domain") or [] - if isinstance(domain, str): - domain = eval(domain) - if len(domain) > 1: - action["domain"] = AND( - [[("invite_token", "!=", False)], normalize_domain(domain)] - ) - else: - action["domain"] = [("invite_token", "!=", False)] - action["display_name"] += _(" (from sharing)") + if ctx.get("search_default_shared_invite", False): + action["display_name"] += _(" (shared)") if search_done is not None: - act_ctx = action.get("context") or {} + act_ctx = action.get("context") or dict() if isinstance(act_ctx, str): act_ctx = eval(act_ctx) - if "search_default_completed" in act_ctx: - if bool(act_ctx["search_default_completed"]) is not bool(search_done): - act_ctx["search_default_completed"] = int(bool(search_done)) - action["context"] = act_ctx + if "search_default_completed" in act_ctx and bool( + act_ctx["search_default_completed"] + ) is not bool(search_done): + act_ctx["search_default_completed"] = int(bool(search_done)) + action["context"] = act_ctx return action diff --git a/survey_input_statistics/views/survey_survey.xml b/survey_input_statistics/views/survey_survey.xml index 9042407..339c916 100644 --- a/survey_input_statistics/views/survey_survey.xml +++ b/survey_input_statistics/views/survey_survey.xml @@ -9,13 +9,13 @@ diff --git a/survey_input_statistics/views/survey_user_input.xml b/survey_input_statistics/views/survey_user_input.xml new file mode 100644 index 0000000..eff1e90 --- /dev/null +++ b/survey_input_statistics/views/survey_user_input.xml @@ -0,0 +1,21 @@ + + + + + survey_input_statistics survey.user_input search + survey.user_input + + 26 + + + + + + + + + + + + +