Skip to content
Snippets Groups Projects
Commit ba907de2 authored by Achraf (abz)'s avatar Achraf (abz)
Browse files

[FIX] stock: Show only affected products for lot_id name_search


What are the steps to reproduce your issue ?

    1. Install 'stock'
    2. Create 'ProductA' with 'Tracking By Lots'
    3. Create some 'Lots/Serial Numbers', for example 'CodeA0 and 'CodeA1'
    4. Go to 'Reporting/Inventory Report'
    5. Remove 'Product > Location' from the search bar.
    6. Click 'Create' and select 'ProductA' with 'WH/Stock' Location

What is currently happening ?

    When you set 'Lot/Serial Number', the available lots to choose
    are not limited to the selected product only.

What are you expecting to happen ?

    Show only lots of the selected product.

Why is this happening ?

    The domain contained no condition which depended on the product.

How to fix the bug ?

    Addition of a condition that depends on the product.

opw-238143

closes odoo/odoo#62040

X-original-commit: 3b33f1d3
Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 938d621d
No related branches found
No related tags found
No related merge requests found
......@@ -33,10 +33,12 @@ class StockQuant(models.Model):
]
if self.env.context.get('active_model') == 'product.product':
domain.insert(0, "('product_id', '=', %s)" % self.env.context.get('active_id'))
if self.env.context.get('active_model') == 'product.template':
elif self.env.context.get('active_model') == 'product.template':
product_template = self.env['product.template'].browse(self.env.context.get('active_id'))
if product_template.exists():
domain.insert(0, "('product_id', 'in', %s)" % product_template.product_variant_ids.ids)
else:
domain.insert(0, "('product_id', '=', product_id)")
return '[' + ', '.join(domain) + ']'
def _domain_product_id(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment