mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] Set Picking Type in Create
[IMP] Flake8
This commit is contained in:
@@ -28,3 +28,13 @@ class StockRequestOrder(models.Model):
|
||||
('warehouse_id', '=', self.warehouse_id.id)], limit=1)
|
||||
if picking_type_id:
|
||||
self._origin.write({'picking_type_id': picking_type_id.id})
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if vals.get('warehouse_id', False):
|
||||
picking_type_id = self.env['stock.picking.type'].\
|
||||
search([('code', '=', 'stock_request_order'),
|
||||
('warehouse_id', '=', vals['warehouse_id'])], limit=1)
|
||||
if picking_type_id:
|
||||
vals.update({'picking_type_id': picking_type_id.id})
|
||||
return super().create(vals)
|
||||
|
||||
Reference in New Issue
Block a user