[FIX] mail: allow to notify a user currently in another company
[FIX] mail: allow to notify a user currently in another company

In particular, the problem forbids a user to lower quantities on a SO
if the responsible is currently in another company.

- Install sale_stock and sale
- Activate Multi-companies
- Create Company A and Company B
- Admin in A and B
- Other user U (e.g. duplicate of Admin) in B only
- U creates a SO with a product, confirms it
- Admin connects to Company A
- U decreases product_uom_qty in a line
- U gets an AccessError

When decreasing the quantity, in sale_stock,
_log_decrease_ordered_quantity is called and calls stock's _log_activity,
that needs access to the responsible or the superuser's partner.
If that user is in another company, this raises an AccessError.

Because it is when accessing the partner that the AccessError is raised,
we cannot cleanly use a check_access_rule to determine when to use sudo.

OPW 2036879

closes odoo/odoo#35132

Signed-off-by: Nans Lefebvre (len) <a573b540d2dde90ba6da3b9d6286c8ec60c10044@odoo.com>
ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo