Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[FIX] stock: do not reserve expired lots" #595

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions addons/product_expiry/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ def _get_formating_options(self, strings):

def _update_reserved_quantity(self, need, location_id, quant_ids=None, lot_id=None, package_id=None, owner_id=None, strict=True):
if self.product_id.use_expiration_date:
if not quant_ids:
quant_ids = self.env['stock.quant']
quant_ids = quant_ids.with_context(with_expiration=self.date)
return super(StockMove, self.with_context(with_expiration=self.date))._update_reserved_quantity(need, location_id, quant_ids, lot_id, package_id, owner_id, strict)
return super()._update_reserved_quantity(need, location_id, quant_ids, lot_id, package_id, owner_id, strict)

def _get_available_quantity(self, location_id, lot_id=None, package_id=None, owner_id=None, strict=False, allow_negative=False):
Expand Down
2 changes: 1 addition & 1 deletion addons/stock/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ def _update_reserved_quantity(self, need, location_id, quant_ids=None, lot_id=No
is performed and reservation is done on the passed quants set
"""
self.ensure_one()
if quant_ids is None:
if not quant_ids:
quant_ids = self.env['stock.quant']
if not lot_id:
lot_id = self.env['stock.lot']
Expand Down