Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] mail_template_multi_company: Don't set default company on mail template #485

Conversation

carmenbianca
Copy link
Member

Fixes #483

Before this commit, this caused a bug that can be summarised as follows:

  1. User A installs mail_template_multi_company.
  2. User A installs another module, say, sale.
  3. User A creates a new company and sets User B as a member of this (and only this) company.
  4. User B tries to send an invoice.

An error occurs at step 4 because of a bug at step 2. At step 2, when the sale module was installed, its mail template (which is used by all companies) defaulted to self.env.company, which was base.main_company. At step 4, using the mail template is forbidden for User B, because the template belongs to a company of which they are not a member.

Removing the default value prevents this problem.

…template

Before this commit, this caused a bug that can be summarised as follows:

1. User A installs mail_template_multi_company.
2. User A installs another module, say, sale.
3. User A creates a new company and sets User B as a member of this (and
   only this) company.
4. User B tries to send an invoice.

An error occurs at step 4 because of a bug at step 2. At step 2, when
the sale module was installed, its mail template (which is used by all
companies) defaulted to self.env.company, which was base.main_company.
At step 4, using the mail template is forbidden for User B, because the
template belongs to a company of which they are not a member.

Removing the default value prevents this problem.

Signed-off-by: Carmen Bianca BAKKER <[email protected]>
@OCA-git-bot
Copy link
Contributor

Hi @Olivier-LAURENT,
some modules you are maintaining are being modified, check this out!

@carmenbianca
Copy link
Member Author

@DaniilDigtyar ping :)

Copy link

@bosd bosd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review LGTM

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Oct 22, 2023
@OCA-git-bot
Copy link
Contributor

Hi @Olivier-LAURENT,
some modules you are maintaining are being modified, check this out!

Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The default company causes misery when testing mail template functionality in unrelated modules.

@StefanRijnhart
Copy link
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-485-by-StefanRijnhart-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 419473b into OCA:14.0 Feb 3, 2025
10 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 443fd82. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved merged 🎉 stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
5 participants