diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index 62f5861afba..6ab3f36d97e 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -185,6 +185,19 @@ class Inventory(models.Model): return True prepare_inventory = action_start + @api.multi + def action_inventory_line_tree(self): + action = self.env.ref('stock.action_inventory_line_tree').read()[0] + action['context'] = { + 'default_location_id': self.location_id.id, + 'default_product_id': self.product_id.id, + 'default_prod_lot_id': self.lot_id.id, + 'default_package_id': self.package_id.id, + 'default_partner_id': self.partner_id.id, + 'default_inventory_id': self.id, + } + return action + @api.multi def _get_inventory_lines_values(self): # TDE CLEANME: is sql really necessary ? I don't think so @@ -271,6 +284,8 @@ class InventoryLine(models.Model): theoretical_qty = fields.Float( 'Theoretical Quantity', compute='_compute_theoretical_qty', digits=dp.get_precision('Product Unit of Measure'), readonly=True, store=True) + inventory_location_id = fields.Many2one( + 'stock.location', 'Location', related='inventory_id.location_id', related_sudo=False) @api.one @api.depends('location_id', 'product_id', 'package_id', 'product_uom_id', 'company_id', 'prod_lot_id', 'partner_id') diff --git a/addons/stock/views/stock_inventory_views.xml b/addons/stock/views/stock_inventory_views.xml index 89412ff1789..ec1791fac24 100644 --- a/addons/stock/views/stock_inventory_views.xml +++ b/addons/stock/views/stock_inventory_views.xml @@ -14,6 +14,40 @@ + + stock.inventory.line.tree2 + stock.inventory.line + + + + + + + + + + + + + + + + + + + stock.inventory.line.search + stock.inventory.line + + + + + + + + + + + stock.inventory.filter stock.inventory @@ -56,6 +90,19 @@ +
+ +