Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Automation Oca

Entity: automation.configuration

Compute Method: _compute_activity_count

View 18.0
Inputs Method Outputs
  • id
- data = self.env["automation.record.step"].read_group(
-             [
-                 ("configuration_id", "in", self.ids),
-                 ("state", "=", "done"),
-                 ("is_test", "=", False),
-             ],
-             [],
-             ["configuration_id", "step_type"],
-             lazy=False,
-         )
- mapped_data = defaultdict(lambda: {})
- for d in data:
-             mapped_data[d["configuration_id"][0]][d["step_type"]] = d["__count"]
- for record in self:
-             record.activity_mail_count = mapped_data[record.id].get("mail", 0)
-             record.activity_action_count = mapped_data[record.id].get("action", 0)
  • activity_mail_count
  • activity_action_count

Back to entity