-
-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] product_multi_company: don't change rules, but respect previous…
… company assignments Remove lots of code thanks to #760. Also, call the new `fill_company_ids` hook, to respect company assignments done before the module installation. @moduon MT-8873
- Loading branch information
Showing
9 changed files
with
15 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,10 @@ Contributors | |
* Prabakaran <[email protected]> | ||
* Karthik <[email protected]> | ||
|
||
* `Moduon <https://www.moduon.team/>`__: | ||
|
||
* Jairo Llopis | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
from . import models | ||
from .hooks import post_init_hook | ||
from .hooks import uninstall_hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,10 @@ | ||
# Copyright 2015-2016 Pedro M. Baeza <[email protected]> | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
import logging | ||
|
||
from odoo import SUPERUSER_ID, api | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
try: | ||
from odoo.addons.base_multi_company import hooks | ||
except ImportError: | ||
_logger.info("Cannot find `base_multi_company` module in addons path.") | ||
from odoo.addons.base_multi_company import hooks | ||
|
||
|
||
def post_init_hook(cr, registry): | ||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
# Change access rule | ||
rule = env.ref("product.product_comp_rule") | ||
rule.write( | ||
{ | ||
"domain_force": ( | ||
"['|', ('company_ids', 'in', company_ids)," | ||
"('company_ids', '=', False)]" | ||
), | ||
} | ||
) | ||
|
||
|
||
def uninstall_hook(cr, registry): | ||
hooks.uninstall_hook( | ||
cr, | ||
"product.product_comp_rule", | ||
) | ||
api.Environment(cr, SUPERUSER_ID, {}) | ||
hooks.fill_company_ids(cr, "product.template") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
# Copyright 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import product_product | ||
from . import product_template |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,7 @@ | |
|
||
* Prabakaran <[email protected]> | ||
* Karthik <[email protected]> | ||
|
||
* `Moduon <https://www.moduon.team/>`__: | ||
|
||
* Jairo Llopis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters