From f8825abf1a6fa871e2f07013a801b62af3a64436 Mon Sep 17 00:00:00 2001 From: mikelarre Date: Thu, 5 May 2016 15:40:06 +0200 Subject: [PATCH] added incomin, outgoing and forecast stock stock_warehouse_orderpoint_stock_info: Search orderpoint rules by product category --- .../__openerp__.py | 2 +- .../models/stock_warehouse_orderpoint.py | 18 +++++++++++++++-- .../views/stock_warehouse_orderpoint_view.xml | 20 +++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/stock_warehouse_orderpoint_stock_info/__openerp__.py b/stock_warehouse_orderpoint_stock_info/__openerp__.py index 02ecb0528..4816e0cc2 100644 --- a/stock_warehouse_orderpoint_stock_info/__openerp__.py +++ b/stock_warehouse_orderpoint_stock_info/__openerp__.py @@ -18,7 +18,7 @@ { "name": "Reordering rules stock info", - "version": "1.0", + "version": "8.0.1.0.0", "depends": [ "stock", ], diff --git a/stock_warehouse_orderpoint_stock_info/models/stock_warehouse_orderpoint.py b/stock_warehouse_orderpoint_stock_info/models/stock_warehouse_orderpoint.py index 6daf3aba0..fed845c0c 100644 --- a/stock_warehouse_orderpoint_stock_info/models/stock_warehouse_orderpoint.py +++ b/stock_warehouse_orderpoint_stock_info/models/stock_warehouse_orderpoint.py @@ -11,9 +11,13 @@ class StockWarehouseOrderpoint(models.Model): @api.one def _product_available_qty(self): - self.product_location_qty = self.product_id.with_context( + product_available = self.product_id.with_context( location=self.location_id.id - )._product_available()[self.product_id.id]['qty_available'] + )._product_available()[self.product_id.id] + self.product_location_qty = product_available['qty_available'] + self.incoming_location_qty = product_available['incoming_qty'] + self.outgoing_location_qty = product_available['outgoing_qty'] + self.virtual_location_qty = product_available['virtual_available'] @api.one @api.depends('product_location_qty', 'product_min_qty') @@ -22,6 +26,16 @@ class StockWarehouseOrderpoint(models.Model): product_location_qty = fields.Float( string='Quantity On Location', compute='_product_available_qty') + incoming_location_qty = fields.Float( + string='Incoming On Location', compute='_product_available_qty') + outgoing_location_qty = fields.Float( + string='Outgoing On Location', compute='_product_available_qty') + virtual_location_qty = fields.Float( + string='Forecast On Location', compute='_product_available_qty') + available = fields.Boolean( string='Is enough product available?', compute='_product_available', store=True) + product_category = fields.Many2one(string='Product Category', + related='product_id.categ_id', + store=True) diff --git a/stock_warehouse_orderpoint_stock_info/views/stock_warehouse_orderpoint_view.xml b/stock_warehouse_orderpoint_stock_info/views/stock_warehouse_orderpoint_view.xml index 745d129bb..e76d4c8f9 100644 --- a/stock_warehouse_orderpoint_stock_info/views/stock_warehouse_orderpoint_view.xml +++ b/stock_warehouse_orderpoint_stock_info/views/stock_warehouse_orderpoint_view.xml @@ -6,8 +6,14 @@ stock.warehouse.orderpoint + + + + + + @@ -21,6 +27,9 @@ + + + @@ -31,6 +40,17 @@ stock.warehouse.orderpoint + + + + + + +