Skip to content

Mail Template Multi Company - access error when using primary button to send email #850

@codeagencybe

Description

@codeagencybe

Module

Mail Template Multi Company

Describe the bug

When using this module and creating a new or duplicating email template for eg sales quotation with explicit use for company 2 while the original template is set to company 1, the primary button to send the quotation from company 2 raises an access error.

While trying to send a quotation from company, the primary button still try to load the template from company 1, and not the new template I set for company 2.

To Reproduce

Affected versions: So far only tested in 18.0 on Runboat

Steps to reproduce the behavior:

  1. create a new template or duplicate an existing template exclusive for company 2
  2. set the new template to company 2 exclusive
  3. set the other existing template to company 1 exclusive
  4. test the visibility by switching between companies - all working fine
  5. create a quotation from company 1, and click the primary button "send quotation" - all working fine
  6. switch to company 2, create a new quotation from company, click the primary button "send quotation" - access error as it try to load the same template from company 1.
  7. send new message from chatter, load the new template from company 2 (it's visible to select), everything loads fine.
Access Error

Uh-oh! Looks like you have stumbled upon some top-secret records.

Sorry, Mitchell Admin (id=2) doesn't have 'read' access to:
- Email Templates, Sales: Send Quotation (mail.template: 10, company=C1 - YourCompany)

Blame the following rules:
- Mail Template multi-company

If you really, really need access, perhaps you can win over your friendly administrator with a batch of freshly baked cookies.

This seems to be a multi-company issue, you might be able to access the record by switching to the company: C1 - YourCompany.

Screenshot:
Image

Expected behavior
Clicking the native primary button should expect to load the company specific default email template but from the active company.

Additional context
Test done from Runboat at http://oca-multi-company-18-0-eb718c4c9300.runboat.odoo-community.org/odoo/sales/21

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions