diff --git a/stock_warehouse_orderpoint_stock_info/README.rst b/stock_warehouse_orderpoint_stock_info/README.rst index ccef39779..edde9b079 100644 --- a/stock_warehouse_orderpoint_stock_info/README.rst +++ b/stock_warehouse_orderpoint_stock_info/README.rst @@ -1,6 +1,13 @@ Reordering Rules stock info =========================== +This modules allows to know the product availability directly in the reordering +rules. + + +Credits +======= + Contributors ------------ * Oihane Crucelaegui diff --git a/stock_warehouse_orderpoint_stock_info/i18n/es.po b/stock_warehouse_orderpoint_stock_info/i18n/es.po index 16fe4eb35..b88c82083 100644 --- a/stock_warehouse_orderpoint_stock_info/i18n/es.po +++ b/stock_warehouse_orderpoint_stock_info/i18n/es.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-17 08:55+0000\n" -"PO-Revision-Date: 2015-02-17 08:55+0000\n" +"POT-Creation-Date: 2015-03-04 11:41+0000\n" +"PO-Revision-Date: 2015-03-04 11:41+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,6 +15,21 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: stock_warehouse_orderpoint_stock_info +#: view:stock.warehouse.orderpoint:stock_warehouse_orderpoint_stock_info.stock_warehouse_orderpoint_search_view +msgid "Availability under minimum" +msgstr "Disponibilidad por debajo del mínimo" + +#. module: stock_warehouse_orderpoint_stock_info +#: view:stock.warehouse.orderpoint:stock_warehouse_orderpoint_stock_info.stock_warehouse_orderpoint_search_view +msgid "Group By" +msgstr "Agrupar por" + +#. module: stock_warehouse_orderpoint_stock_info +#: field:stock.warehouse.orderpoint,available:0 +msgid "Is enough product available?" +msgstr "Hay producto suficiente?" + #. module: stock_warehouse_orderpoint_stock_info #: model:ir.model,name:stock_warehouse_orderpoint_stock_info.model_stock_warehouse_orderpoint msgid "Minimum Inventory Rule" @@ -28,59 +43,5 @@ msgstr "Reglas" #. module: stock_warehouse_orderpoint_stock_info #: view:stock.warehouse.orderpoint:stock_warehouse_orderpoint_stock_info.stock_warehouse_orderpoint_form_view msgid "Stock Info" -msgstr "Info. Stock" +msgstr "Info. de Stock" -#. module: stock_warehouse_orderpoint_stock_info -#: help:stock.warehouse.orderpoint,product_qty_available:0 -msgid "" -"Current quantity of products.\n" -"In a context with a single Stock Location, this includes goods stored at " -"this Location, or any of its children.\n" -"In a context with a single Warehouse, this includes goods stored in the " -"Stock Location of this Warehouse, or any of its children.\n" -"stored in the Stock Location of the Warehouse of this Shop, or any of its " -"children.\n" -"Otherwise, this includes goods stored in any Stock Location with 'internal' " -"type." -msgstr "" -"Cantidad actual de los productos.\n" -"En un contexto de una sola ubicación de existencias, esto incluye los bienes " -"almacenados en esta ubicación, o cualquiera de sus hijas.\n" -"En un contexto de un solo almacén, esto incluye los bienes almacenados en la " -"ubicación de existencias de ese almacén, o cualquiera de sus hijas.\n" -"En cualquier otro caso, esto incluye los bienes almacenados en cualquier " -"ubicación de existencias de tipo 'Interna'." - -#. module: stock_warehouse_orderpoint_stock_info -#: field:stock.warehouse.orderpoint,product_qty_available:0 -msgid "Quantity On Hand" -msgstr "Cantidad disponible" - -#. module: stock_warehouse_orderpoint_stock_info -#: help:stock.warehouse.orderpoint,product_virtual_available:0 -msgid "" -"Forecast quantity (computed as Quantity On Hand - Outgoing + Incoming)\n" -"In a context with a single Stock Location, this includes goods stored in " -"this location, or any of its children.\n" -"In a context with a single Warehouse, this includes goods stored in the " -"Stock Location of this Warehouse, or any of its children.\n" -"Otherwise, this includes goods stored in any Stock Location with 'internal' " -"type." -msgstr "" -"Cantidad prevista (calculada como cantidad a mano - saliente + entrante)\n" -"En un contexto de una sola ubicación de existencias, esto incluye los bienes " -"almacenados en esta ubicación, o cualquiera de sus hijas.\n" -"En un contexto de un solo almacén, esto incluye los bienes almacenados en la " -"ubicación de existencias de ese almacén, o cualquiera de sus hijas.\n" -"En cualquier otro caso, esto incluye los bienes almacenados en cualquier " -"ubicación de existencias de tipo 'Interna'." - -#. module: stock_warehouse_orderpoint_stock_info -#: field:stock.warehouse.orderpoint,product_virtual_available:0 -msgid "Forecast Quantity" -msgstr "Cantidad prevista" - -#. module: stock_warehouse_orderpoint_stock_info -#: field:stock.warehouse.orderpoint,product_location_qty:0 -msgid "Quantity On Location" -msgstr "Cantidad en la ubicación" diff --git a/stock_warehouse_orderpoint_stock_info/i18n/stock_warehouse_orderpoint_stock_info.pot b/stock_warehouse_orderpoint_stock_info/i18n/stock_warehouse_orderpoint_stock_info.pot index 061c6b773..afc9dc3c9 100644 --- a/stock_warehouse_orderpoint_stock_info/i18n/stock_warehouse_orderpoint_stock_info.pot +++ b/stock_warehouse_orderpoint_stock_info/i18n/stock_warehouse_orderpoint_stock_info.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-17 08:54+0000\n" -"PO-Revision-Date: 2015-02-17 08:54+0000\n" +"POT-Creation-Date: 2015-03-04 11:39+0000\n" +"PO-Revision-Date: 2015-03-04 11:39+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,6 +15,21 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: stock_warehouse_orderpoint_stock_info +#: view:stock.warehouse.orderpoint:stock_warehouse_orderpoint_stock_info.stock_warehouse_orderpoint_search_view +msgid "Availability under minimum" +msgstr "" + +#. module: stock_warehouse_orderpoint_stock_info +#: view:stock.warehouse.orderpoint:stock_warehouse_orderpoint_stock_info.stock_warehouse_orderpoint_search_view +msgid "Group By" +msgstr "" + +#. module: stock_warehouse_orderpoint_stock_info +#: field:stock.warehouse.orderpoint,available:0 +msgid "Is enough product available?" +msgstr "" + #. module: stock_warehouse_orderpoint_stock_info #: model:ir.model,name:stock_warehouse_orderpoint_stock_info.model_stock_warehouse_orderpoint msgid "Minimum Inventory Rule" @@ -30,43 +45,3 @@ msgstr "" msgid "Stock Info" msgstr "" -#. module: stock_warehouse_orderpoint_stock_info -#: help:stock.warehouse.orderpoint,product_qty_available:0 -msgid "" -"Current quantity of products.\n" -"In a context with a single Stock Location, this includes goods stored at " -"this Location, or any of its children.\n" -"In a context with a single Warehouse, this includes goods stored in the " -"Stock Location of this Warehouse, or any of its children.\n" -"stored in the Stock Location of the Warehouse of this Shop, or any of its " -"children.\n" -"Otherwise, this includes goods stored in any Stock Location with 'internal' " -"type." -msgstr "" - -#. module: stock_warehouse_orderpoint_stock_info -#: field:stock.warehouse.orderpoint,product_qty_available:0 -msgid "Quantity On Hand" -msgstr "" - -#. module: stock_warehouse_orderpoint_stock_info -#: help:stock.warehouse.orderpoint,product_virtual_available:0 -msgid "" -"Forecast quantity (computed as Quantity On Hand - Outgoing + Incoming)\n" -"In a context with a single Stock Location, this includes goods stored in " -"this location, or any of its children.\n" -"In a context with a single Warehouse, this includes goods stored in the " -"Stock Location of this Warehouse, or any of its children.\n" -"Otherwise, this includes goods stored in any Stock Location with 'internal' " -"type." -msgstr "" - -#. module: stock_warehouse_orderpoint_stock_info -#: field:stock.warehouse.orderpoint,product_virtual_available:0 -msgid "Forecast Quantity" -msgstr "" - -#. module: stock_warehouse_orderpoint_stock_info -#: field:stock.warehouse.orderpoint,product_location_qty:0 -msgid "Quantity On Location" -msgstr "" 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 7c3802f25..6daf3aba0 100644 --- a/stock_warehouse_orderpoint_stock_info/models/stock_warehouse_orderpoint.py +++ b/stock_warehouse_orderpoint_stock_info/models/stock_warehouse_orderpoint.py @@ -4,45 +4,24 @@ ############################################################################## from openerp import models, fields, api -from openerp.tools.float_utils import float_round class StockWarehouseOrderpoint(models.Model): _inherit = 'stock.warehouse.orderpoint' @api.one + def _product_available_qty(self): + self.product_location_qty = self.product_id.with_context( + location=self.location_id.id + )._product_available()[self.product_id.id]['qty_available'] + + @api.one + @api.depends('product_location_qty', 'product_min_qty') def _product_available(self): - domain_quant = [('location_id', '=', self.location_id.id), - ('product_id', '=', self.product_id.id)] - quants = self.env['stock.quant'].read_group( - domain_quant, ['product_id', 'qty'], ['product_id']) - quants = dict(map(lambda x: (x['product_id'][0], x['qty']), quants)) - self.product_location_qty = float_round( - quants.get(self.product_id.id, 0.0), - precision_rounding=self.product_uom.rounding) + self.available = self.product_location_qty > self.product_min_qty product_location_qty = fields.Float( - string='Quantity On Location', compute='_product_available') - product_qty_available = fields.Float( - string='Quantity On Hand', related='product_id.qty_available', - help="Current quantity of products.\n" - "In a context with a single Stock Location, this includes " - "goods stored at this Location, or any of its children.\n" - "In a context with a single Warehouse, this includes " - "goods stored in the Stock Location of this Warehouse, or any " - "of its children.\n" - "stored in the Stock Location of the Warehouse of this Shop, " - "or any of its children.\n" - "Otherwise, this includes goods stored in any Stock Location " - "with 'internal' type.") - product_virtual_available = fields.Float( - string='Forecast Quantity', related='product_id.virtual_available', - help="Forecast quantity (computed as Quantity On Hand " - "- Outgoing + Incoming)\n" - "In a context with a single Stock Location, this includes " - "goods stored in this location, or any of its children.\n" - "In a context with a single Warehouse, this includes " - "goods stored in the Stock Location of this Warehouse, or any " - "of its children.\n" - "Otherwise, this includes goods stored in any Stock Location " - "with 'internal' type.") + string='Quantity On Location', compute='_product_available_qty') + available = fields.Boolean( + string='Is enough product available?', compute='_product_available', + 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 80b8ecd9a..2c93912c7 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 @@ -8,8 +8,7 @@ - - + @@ -22,12 +21,23 @@ - - + + stock.warehouser.orderpoint.search + stock.warehouse.orderpoint + + + + + + + +