mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
display picking type in move location wizard, and get a default value
This commit is contained in:
committed by
Joan Sisquella
parent
0d9a70990a
commit
3efe069e65
@@ -11,6 +11,14 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
_name = "wiz.stock.move.location"
|
||||
_description = 'Wizard move location'
|
||||
|
||||
@api.multi
|
||||
def _get_default_picking_type_id(self):
|
||||
company_id = self.env.context.get('company_id') or \
|
||||
self.env.user.company_id.id
|
||||
return self.env['stock.picking.type'].search(
|
||||
[('code', '=', 'internal'),
|
||||
('warehouse_id.company_id', '=', company_id)], limit=1).id
|
||||
|
||||
origin_location_disable = fields.Boolean(
|
||||
compute='_compute_readonly_locations')
|
||||
origin_location_id = fields.Many2one(
|
||||
@@ -32,7 +40,8 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
comodel_name="wiz.stock.move.location.line",
|
||||
)
|
||||
picking_type_id = fields.Many2one(
|
||||
comodel_name='stock.picking.type'
|
||||
comodel_name='stock.picking.type',
|
||||
default=_get_default_picking_type_id,
|
||||
)
|
||||
picking_id = fields.Many2one(
|
||||
string="Connected Picking",
|
||||
@@ -88,8 +97,7 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
|
||||
def _create_picking(self):
|
||||
return self.env['stock.picking'].create({
|
||||
'picking_type_id': self.picking_type_id.id or
|
||||
self.env.ref('stock.picking_type_internal').id,
|
||||
'picking_type_id': self.picking_type_id.id,
|
||||
'location_id': self.origin_location_id.id,
|
||||
'location_dest_id': self.destination_location_id.id,
|
||||
})
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
</label>
|
||||
<field name="edit_locations" widget="boolean_toggle"/>
|
||||
</div>
|
||||
<group name="picking_type">
|
||||
<field name="picking_type_id"/>
|
||||
</group>
|
||||
<group name="main">
|
||||
<field name="origin_location_disable" invisible="True"/>
|
||||
<field name="origin_location_id" attrs="{'readonly': [('origin_location_disable', '=', True)]}"/>
|
||||
|
||||
Reference in New Issue
Block a user