stock.py 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. # For copyright and license notices, see __openerp__.py file in module root
  4. # directory
  5. ##############################################################################
  6. from openerp import models, fields, api
  7. class stock_picking(models.Model):
  8. _inherit = 'stock.picking'
  9. new_location_id = fields.Many2one('stock.location', 'Ubicacion de Origen', domain="[('usage','<>','view')]")
  10. # readonly=True,
  11. # states={
  12. # 'draft': [('readonly', False)],
  13. # 'waiting': [('readonly', False)],
  14. # 'confirmed': [('readonly', False)],
  15. # },)
  16. new_location_dest_id = fields.Many2one('stock.location', 'Ubicacion de destino', domain="[('usage','<>','view')]")
  17. # readonly=True,
  18. # states={
  19. # 'draft': [('readonly', False)],
  20. # 'waiting': [('readonly', False)],
  21. # 'confirmed': [('readonly', False)],
  22. # },
  23. @api.one
  24. def update_locations(self):
  25. vals = {
  26. 'location_id': self.new_location_id.id,
  27. 'location_dest_id': self.new_location_dest_id.id
  28. }
  29. self.move_lines.write(vals)