2025-01-06 10:57:38 +07:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
|
|
|
|
from odoo import models
|
|
|
|
|
|
|
|
|
|
|
|
class StockPicking(models.Model):
|
|
|
|
_inherit = 'stock.picking'
|
|
|
|
|
|
|
|
def _create_move_from_pos_order_lines(self, lines):
|
|
|
|
lines_to_unreserve = self.env['pos.order.line']
|
|
|
|
for line in lines:
|
|
|
|
if line.order_id.shipping_date:
|
|
|
|
continue
|
|
|
|
if any(wh != line.order_id.config_id.warehouse_id for wh in line.sale_order_line_id.move_ids.location_id.warehouse_id):
|
|
|
|
continue
|
|
|
|
lines_to_unreserve |= line
|
|
|
|
lines_to_unreserve.sale_order_line_id.move_ids.filtered(lambda ml: ml.state not in ['cancel', 'done'])._do_unreserve()
|
2025-03-04 12:23:19 +07:00
|
|
|
return super()._create_move_from_pos_order_lines(lines.filtered(lambda l: not l.sale_order_line_id or (l.sale_order_line_id.has_valued_move_ids() or not l.sale_order_line_id.move_ids)))
|