[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) <sgv@odoo.com>
This commit is contained in:
Xavier ALT
2024-01-24 00:16:47 +00:00
parent 4544b4642f
commit 4c01f803be
@@ -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')