From 7ab9d0e468fc5b35e55b65998b3093bc091e8307 Mon Sep 17 00:00:00 2001 From: "Nasreddin Boulif (bon)" Date: Wed, 7 Feb 2024 16:36:24 +0100 Subject: [PATCH] [FIX] event_crm: allow event with company in rules without company Steps to reproduce: - Install `event_crm` module - Create an Event with a company - Go to `Events > Configuration > Event Lead Rules` - Create a new rule and set no company - Try to set the event created above for Event field Issue: Event created not displayed as possible value for the Event field. Cause: Because we have `check_company=True` set on `event_id` field, the field will be filtered based on the `company_id` field, and since no company is set on the rule, events with company will not be listed. Commit that introduced the issue: https://github.com/odoo/odoo/commit/0479b2b59466ae1d6d74165345aa3a7dc5de24ed Solution: Revert to the previous behavior (remove `check_company=True` from `event_id` field and use a domain instead). opw-3715864 closes odoo/odoo#154009 X-original-commit: 13cb20dafb6dd473fe71b605a2adf70fa0ac368e Signed-off-by: Thibault Delavallee (tde) Signed-off-by: Nasreddin Boulif (bon) --- addons/event_crm/models/event_lead_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/event_crm/models/event_lead_rule.py b/addons/event_crm/models/event_lead_rule.py index b2e78f339bc..f4f62ee2b0e 100644 --- a/addons/event_crm/models/event_lead_rule.py +++ b/addons/event_crm/models/event_lead_rule.py @@ -93,7 +93,7 @@ class EventLeadRule(models.Model): help='Filter the attendees to include those of this specific event category. If not set, no event category restriction will be applied.') event_id = fields.Many2one( 'event.event', string='Event', - check_company=True, + domain="[('company_id', 'in', [company_id or current_company_id, False])]", help='Filter the attendees to include those of this specific event. If not set, no event restriction will be applied.') company_id = fields.Many2one( 'res.company', string='Company',