# -*- coding: utf-8 -*-
#################################################################################
#
#    Copyright (c) 2015-Present Webkul Software Pvt. Ltd. (<https://webkul.com/>)
#
#################################################################################
import logging
from openerp.exceptions import Warning
_logger = logging.getLogger(__name__)
from openerp import models, fields, api
class wk_stock_picking_wizard(models.TransientModel):
	_name= 'wk.stock.picking.wizard'
	picking_count = fields.Integer(strnig='Total Effected Picking ', readonly=1)

	@api.model
	def default_get(self, fields):
		return {'picking_count':len(self._context['active_ids']) }


	@api.multi
	def generate_shipment_label(self):
		for picking  in self.env['stock.picking'].browse(self._context['active_ids']):
			if picking.carrier_id.delivery_type not in ['fixed','based_on_rule']:				
				picking.send_to_shipper()
	@api.multi
	def void_shipment(self):		
		for picking  in self.env['stock.picking'].browse(self._context['active_ids']):
			if picking.carrier_id.delivery_type not in ['fixed','based_on_rule']:
				picking.cancel_shipment()

		