Skip to content

Commit

Permalink
[IMP] add default method for picking_type_id
Browse files Browse the repository at this point in the history
  • Loading branch information
bguillot committed Oct 25, 2016
1 parent 1cca413 commit 687efb2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion delivery_carrier_deposit/wizard/deposit.py
Expand Up @@ -35,6 +35,13 @@ class DeliveryDepositWizard(models.TransientModel):
def _get_carrier_type_selection(self):
return self.env['delivery.carrier']._get_carrier_type_selection()

@api.model
def _get_default_picking_type(self):
warehouse = self.env['stock.warehouse'].search(
[('company_id', '=', self.env.user.company_id.id)])
return (warehouse and warehouse[0].out_type_id
and warehouse[0].out_type_id.id or None)

carrier_type = fields.Selection(
'_get_carrier_type_selection', string='Delivery Method Type',
required=True, help="Carrier type (combines several delivery "
Expand All @@ -43,7 +50,8 @@ def _get_carrier_type_selection(self):
picking_type_id = fields.Many2one(
comodel_name='stock.picking.type',
string='Picking Type',
required=True)
required=True,
default=_get_default_picking_type)

@api.model
def _prepare_deposit_slip(self):
Expand Down

0 comments on commit 687efb2

Please sign in to comment.