Files
odoo_source/addons/delivery/models/base_config_settings.py
T
Nicolas Martinelli 037cfc9f67 [FIX] delivery: products not shared
- Define 2 companies A and B. Delivery methods are linked to products in
  company A
- Deactivate 'Share product to all companies'
- Create a user B in Company B only
- As user B, create a SO and open the drop-down list for delivery
  methods

An access error is raised.

Delivery methods should follow the same record rules than the products
they are linked to.

opw-1815490
2018-03-06 10:02:44 +01:00

18 lines
587 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class BaseConfigSettings(models.TransientModel):
_inherit = 'base.config.settings'
@api.multi
def set_auth_company_share_product(self):
self.ensure_one()
res = super(BaseConfigSettings, self).set_auth_company_share_product()
delivery_rule = self.env.ref('delivery.delivery_comp_rule', False)
if delivery_rule:
delivery_rule.write({'active': not bool(self.company_share_product)})
return res