mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[FIX] stock_available_info_popup: warehouse context
TT31716
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from collections import defaultdict
|
||||
from datetime import timedelta
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
@@ -20,7 +21,17 @@ class SaleOrderLine(models.Model):
|
||||
if not line.display_qty_widget:
|
||||
remaining |= line
|
||||
continue
|
||||
product = line.product_id
|
||||
confirm_date = (
|
||||
line.order_id.date_order
|
||||
if line.order_id.state in ['sale', 'done']
|
||||
else fields.Datetime.now()
|
||||
)
|
||||
scheduled_date = (
|
||||
confirm_date + timedelta(line.customer_lead or 0.0)
|
||||
)
|
||||
product = line.product_id.with_context(
|
||||
to_date=scheduled_date, warehouse=line.order_id.warehouse_id.id
|
||||
)
|
||||
qty_processed = qty_processed_per_product[product.id]
|
||||
line.immediately_usable_qty_today = \
|
||||
product.immediately_usable_qty - qty_processed
|
||||
|
||||
Reference in New Issue
Block a user