-
-
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.
[IMP] sale_stock_warehouse_multicompany: security
Allow to validate a picking linked to a SO of another company without requiring enabling access to that company
- Loading branch information
Showing
2 changed files
with
17 additions
and
0 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
from . import sale_order | ||
from . import sale_order_line | ||
from . import stock_route | ||
from . import stock_picking |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2025 Jacques-Etienne Baudoux (BCIM) <je@bcim.be> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockPicking(models.Model): | ||
_inherit = "stock.picking" | ||
|
||
def _get_allowed_companies(self): | ||
return self.company_id | self.sudo().move_ids.sale_line_id.company_id | ||
|
||
def button_validate(self): | ||
# Extend access to all related SO companies | ||
self = self.with_context(allowed_company_ids=self._get_allowed_companies().ids) | ||
return super().button_validate() |