Skip to content

Commit

Permalink
[IMP] sale_stock_warehouse_multicompany: security
Browse files Browse the repository at this point in the history
Allow to validate a picking linked to a SO of another company without
requiring enabling access to that company
  • Loading branch information
jbaudoux committed Jan 3, 2025
1 parent 8767505 commit c0f94e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions sale_stock_warehouse_multicompany/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
from . import sale_order
from . import sale_order_line
from . import stock_route
from . import stock_picking
16 changes: 16 additions & 0 deletions sale_stock_warehouse_multicompany/models/stock_picking.py
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()

0 comments on commit c0f94e7

Please sign in to comment.