10000 [FIX] purchase_stock: Fallback on archived picking type · odoo/odoo@ad4f6d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad4f6d4

Browse files
committed
[FIX] purchase_stock: Fallback on archived picking type
In 18.0 the warehouse on new company is optional and different document raise a redirectWarning when needed. However picking_type_id is required in 18.0 but it's an error since service or other purchase don't need it. So we just add an archived picking type if we don't find a default. So user can create a multi company incoming picking type and use it to automaticaly filter and bypass the error. We also remove the rediret warning at this point. In master we will remove the optional and delete this hack closes #194897 Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
1 parent c067a03 commit ad4f6d4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

addons/purchase_stock/models/purchase_order.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,8 @@ def _get_picking_type(self, company_id):
253253
picking_type = self.env['stock.picking.type'].search([('code', '=', 'incoming'), ('warehouse_id.company_id', '=', company_id)])
254254
if not picking_type:
255255
picking_type = self.env['stock.picking.type'].search([('code', '=', 'incoming'), ('warehouse_id', '=', False)])
256-
company_warehouse = self.env['stock.warehouse'].search([('company_id', '=', company_id)], limit=1)
257-
if not company_warehouse:
258-
self.env['stock.warehouse']._warehouse_redirect_warning()
256+
if not picking_type:
257+
picking_type = self.env['stock.picking.type'].with_context(active_test=False).search([('code', '=', 'incoming'), ('warehouse_id', '=', False)])
259258
return picking_type[:1]
260259

261260
def _prepare_group_vals(self):

0 commit comments

Comments
 (0)
0