diff --git a/stock_inventory_valuation_ods/inventory.ods b/stock_inventory_valuation_ods/inventory.ods index 6acaf7d..12d2870 100644 Binary files a/stock_inventory_valuation_ods/inventory.ods and b/stock_inventory_valuation_ods/inventory.ods differ diff --git a/stock_inventory_valuation_ods/inventory_grouped.ods b/stock_inventory_valuation_ods/inventory_grouped.ods new file mode 100644 index 0000000..8886005 Binary files /dev/null and b/stock_inventory_valuation_ods/inventory_grouped.ods differ diff --git a/stock_inventory_valuation_ods/inventory_grouped.py b/stock_inventory_valuation_ods/inventory_grouped.py new file mode 100644 index 0000000..edd01af --- /dev/null +++ b/stock_inventory_valuation_ods/inventory_grouped.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp.report import report_sxw + + +class Parser(report_sxw.rml_parse): + def __init__(self, cr, uid, name, context=None): + super(Parser, self).__init__(cr, uid, name, context=context) + self.localcontext.update({ + 'group_lines': self._group_lines, + }) + + def _group_lines(self, inventory, context=None): + assert inventory, 'Missing inventory' + self.cr.execute(""" + SELECT + min(id) AS min_line_id, + product_id, + package_id, + prod_lot_id, + product_uom_id, + standard_price, + sum(product_qty) AS product_qty, + sum(theoretical_qty) AS theoretical_qty + FROM stock_inventory_line + WHERE inventory_id=%s + GROUP BY product_id, package_id, prod_lot_id, + product_uom_id, standard_price + """, (inventory.id, )) + res = [] + silo = self.pool['stock.inventory.line'] + for row in self.cr.dictfetchall(): + row['min_line'] = silo.browse( + self.cr, self.uid, row['min_line_id'], context=context) + res.append(row) + return res diff --git a/stock_inventory_valuation_ods/report.xml b/stock_inventory_valuation_ods/report.xml index b9f1f11..8f5d20d 100644 --- a/stock_inventory_valuation_ods/report.xml +++ b/stock_inventory_valuation_ods/report.xml @@ -4,7 +4,7 @@ - Inventory Valuation ODS + Inventory Valuation per Location (ODS) stock.inventory stock.inventory.ods aeroo @@ -16,12 +16,32 @@ - Inventory Valuation ODS + Inventory Valuation per Location ODS stock.inventory client_print_multi + + Inventory Valuation (ODS) + stock.inventory + stock.inventory.grouped.ods + aeroo + oo-ods + stock_inventory_valuation_ods/inventory_grouped.ods + loc + stock_inventory_valuation_ods/inventory_grouped.py + file + + + + + Inventory Valuation ODS + stock.inventory + client_print_multi + + +