[FIX] stock: inventory adjustments fixes
- When locations are activated, fix not being able to add a quant for tracked products just after creating one from the 'update quantity' window due to Inventory Adjustment location being auto-selected [since it is the last quant] - Fix quant not properly making fields invisible after confirming from the stock track confirmation window closes odoo/odoo#79338 Pr: https://github.com/odoo/odoo/pull/78768 Task-id: 2674732 X-original-commit: ff26704e7afaa537530c0e092a88b73ee791775f Signed-off-by: Tiffany Chang <tic@odoo.com> Signed-off-by: npi-odoo <npi@odoo.com>
This commit is contained in:
@@ -557,8 +557,9 @@ class StockQuant(models.Model):
|
||||
if self.location_id:
|
||||
return
|
||||
if self.product_id.tracking in ['lot', 'serial']:
|
||||
previous_quants = self.env['stock.quant'].search(
|
||||
[('product_id', '=', self.product_id.id)], limit=1, order='create_date desc')
|
||||
previous_quants = self.env['stock.quant'].search([
|
||||
('product_id', '=', self.product_id.id),
|
||||
('location_id.usage', 'in', ['internal', 'transit'])], limit=1, order='create_date desc')
|
||||
if previous_quants:
|
||||
self.location_id = previous_quants.location_id
|
||||
if not self.location_id:
|
||||
|
||||
@@ -13,8 +13,8 @@ class StockTrackConfirmation(models.TransientModel):
|
||||
product_ids = fields.Many2many('product.product', string='Products')
|
||||
|
||||
def action_confirm(self):
|
||||
for confirmation in self:
|
||||
confirmation.quant_ids._apply_inventory()
|
||||
self.quant_ids._apply_inventory()
|
||||
self.quant_ids.inventory_quantity_set = False
|
||||
|
||||
@api.onchange('product_ids')
|
||||
def _onchange_quants(self):
|
||||
|
||||
Reference in New Issue
Block a user