stock_picking.py 781 B

1234567891011121314151617181920
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo import models
  4. class StockPicking(models.Model):
  5. _inherit = 'stock.picking'
  6. def _create_move_from_pos_order_lines(self, lines):
  7. lines_to_unreserve = self.env['pos.order.line']
  8. for line in lines:
  9. if line.order_id.to_ship:
  10. continue
  11. if any(wh != line.order_id.config_id.warehouse_id for wh in line.sale_order_line_id.move_ids.location_id.warehouse_id):
  12. continue
  13. lines_to_unreserve |= line
  14. lines_to_unreserve.sale_order_line_id.move_ids.filtered(lambda ml: ml.state not in ['cancel', 'done'])._do_unreserve()
  15. return super()._create_move_from_pos_order_lines(lines)