From 4c01f803be3526f27b6589021645228ff247e897 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Tue, 23 Jan 2024 12:27:35 +0100 Subject: [PATCH] [FIX] hr_recruitment: "Generate Email" invisible on new link tracker To reproduce on runbot: - Log-in as admin - Enable debug mode - Go to Settings / General Settings and ensure that there is a alias domain configured for the current company - Go to recruitment app - on "Experienced Developer", open the option dropdown (meatball) and click on "Trackers" - observe there is no button "Generate Email" The `has_domain` field serve to check if the mail alias domain is correctly configured, before odoo/odoo@638e0f658, is was computed only from the `mail.catchall.domain` ICP, now we only consider the alias domain from the recruitment source alias. But for new record there is no alias, so `has_domain` is always falsy which prevent the `Generate Email` button to be show. This commit fallback to the job's or user's current company mail alias domain to check if mail alias is correctly configured when there is no alias on the recruitment source. closes odoo/odoo#150645 Signed-off-by: Sofie Gvaladze (sgv) --- addons/hr_recruitment/models/hr_recruitment_source.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/hr_recruitment/models/hr_recruitment_source.py b/addons/hr_recruitment/models/hr_recruitment_source.py index 8a3e765422e..7e10819ba4e 100644 --- a/addons/hr_recruitment/models/hr_recruitment_source.py +++ b/addons/hr_recruitment/models/hr_recruitment_source.py @@ -17,7 +17,11 @@ class RecruitmentSource(models.Model): def _compute_has_domain(self): for source in self: - source.has_domain = bool(source.alias_id.alias_domain) + if source.alias_id: + source.has_domain = bool(source.alias_id.alias_domain_id) + else: + source.has_domain = bool(source.job_id.company_id.alias_domain_id + or self.env.company.alias_domain_id) def create_alias(self): campaign = self.env.ref('hr_recruitment.utm_campaign_job')