Skip to content

Commit

Permalink
[FIX] purchase_operating_unit: default picking_type without OU
Browse files Browse the repository at this point in the history
  • Loading branch information
aleuffre committed Jan 19, 2024
1 parent 8c5be33 commit 47f04f9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions purchase_operating_unit/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ def _default_picking_type(self):
res = super(PurchaseOrder, self)._default_picking_type()
type_obj = self.env["stock.picking.type"]
operating_unit = self.env["res.users"].operating_unit_default_get(self.env.uid)
types = type_obj.search(
[
("code", "=", "incoming"),
("warehouse_id.operating_unit_id", "=", operating_unit.id),
]
)
if types:
res = types[:1].id
if operating_unit:
types = type_obj.search(
[
("code", "=", "incoming"),
("warehouse_id.operating_unit_id", "=", operating_unit.id),
]
)
if types:
res = types[0].id
return res

READONLY_STATES = {
Expand Down

0 comments on commit 47f04f9

Please sign in to comment.