# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields, api


class stock_picking(models.Model):
    _inherit = 'stock.picking'

    new_location_id = fields.Many2one('stock.location', 'Ubicacion de Origen', domain="[('usage','<>','view')]")
        # readonly=True,
        # states={
        #     'draft': [('readonly', False)],
        #     'waiting': [('readonly', False)],
        #     'confirmed': [('readonly', False)],
        #     },)
    new_location_dest_id = fields.Many2one('stock.location', 'Ubicacion de destino', domain="[('usage','<>','view')]")
        # readonly=True,
        # states={
        #     'draft': [('readonly', False)],
        #     'waiting': [('readonly', False)],
        #     'confirmed': [('readonly', False)],
        #     },
    @api.one
    def update_locations(self):
        vals = {
            'location_id': self.new_location_id.id,
            'location_dest_id': self.new_location_dest_id.id
            }
        self.move_lines.write(vals)