Files
odoo-usability/stock_inventory_valuation_ods/stock_inventory.py
Alexis de Lattre a21ec776c1 MIG account_invoice_margin adn stock_inventory_valudation_ods
FIX for my PR is merged https://github.com/odoo/odoo/pull/35073
Fix in stock_usability for manual creation of stock moves
2019-07-22 16:35:38 +02:00

34 lines
1.1 KiB
Python

# Copyright 2016-2019 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class StockInventory(models.Model):
_inherit = 'stock.inventory'
def report_group_lines(self):
self.ensure_one()
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
""", (self.id, ))
res = []
silo = self.env['stock.inventory.line']
for row in self._cr.dictfetchall():
row['min_line'] = silo.browse(row['min_line_id'])
res.append(row)
return res