mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[FIX] stock_quantity_history_location: stock.quant action fixup!
This commit is contained in:
@@ -54,11 +54,20 @@ class TestStockQuantityHistoryLocation(SavepointCase):
|
||||
to_date="2019-08-10").qty_available, 0.0)
|
||||
|
||||
def test_wizard_current(self):
|
||||
wizard = self.env['stock.quantity.history'].create({
|
||||
"location_id": self.test_stock_loc.id,
|
||||
"include_child_locations": False,
|
||||
"compute_at_date": 0,
|
||||
})
|
||||
action = wizard.with_context().open_table()
|
||||
self.assertEquals(action['domain'],
|
||||
[('location_id', '=', self.test_stock_loc.id)])
|
||||
wizard = self.env['stock.quantity.history'].create({
|
||||
"location_id": self.test_stock_loc.id,
|
||||
"include_child_locations": True,
|
||||
"compute_at_date": 0,
|
||||
})
|
||||
action = wizard.with_context().open_table()
|
||||
self.assertEquals(action['context']['location'],
|
||||
self.test_stock_loc.id)
|
||||
self.assertEquals(action['domain'],
|
||||
[('location_id', 'child_of',
|
||||
self.test_stock_loc.id)])
|
||||
|
||||
@@ -20,8 +20,15 @@ class StockQuantityHistory(models.TransientModel):
|
||||
ctx = action['context']
|
||||
if isinstance(ctx, str):
|
||||
ctx = ast.literal_eval(ctx)
|
||||
action['domain'] = [('type', '=', 'product')]
|
||||
if self.location_id:
|
||||
# If we are opening the current quants, filter by domain
|
||||
if self.location_id and not self.compute_at_date and not \
|
||||
self.env.context.get('valuation'):
|
||||
if self.include_child_locations:
|
||||
action['domain'] = [
|
||||
('location_id', 'child_of', self.location_id.id)]
|
||||
else:
|
||||
action['domain'] = [('location_id', '=', self.location_id.id)]
|
||||
elif self.location_id:
|
||||
ctx['location'] = self.location_id.id
|
||||
ctx['compute_child'] = self.include_child_locations
|
||||
if ctx.get('company_owned', False):
|
||||
|
||||
Reference in New Issue
Block a user