Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Discuss
Entity: ir.actions.server
Compute Method: _compute_activity_user_info
| Inputs | Method | Outputs |
|---|---|---|
|
- to_reset = self.filtered(lambda act: act.state != 'next_activity') - if to_reset: - to_reset.activity_summary = False - to_reset.activity_note = False - to_reset.activity_date_deadline_range = False - to_reset.activity_date_deadline_range_type = False - to_reset.activity_user_type = False - to_reset.activity_user_id = False - to_reset.activity_user_field_name = False - to_default = self.filtered(lambda act: act.state == 'next_activity') - for action in to_default: - if not action.activity_summary: - action.activity_summary = action.activity_type_id.summary - if not action.activity_date_deadline_range_type: - action.activity_date_deadline_range_type = 'days' - if not action.activity_user_type: - action.activity_user_type = 'specific' - if not action.activity_user_field_name: - action.activity_user_field_name = 'user_id' + to_compute = self.filtered("activity_user_type") + (self - to_compute).activity_user_id = False + (self - to_compute).activity_user_field_name = False + for action in to_compute: + if action.activity_user_type == 'specific': + action.activity_user_field_name = False + else: + action.activity_user_id = False + IrModelFields = self.env['ir.model.fields'] + domain = [('model', '=', action.model_id.model), ("relation", "=", "res.users")] + action.activity_user_field_name = ( + IrModelFields.search([*domain, ("name", "=", "user_id")], limit=1) + or IrModelFields.search(domain, limit=1) + ).name |
|
