Debian Codegraph @

addons/product_expiry/report/report_stock_quantity.py

raw
1 # Part of Odoo. See LICENSE file for full copyright and licensing details.
2
3 from odoo import models
4
5
6 class ReportStockQuantity(models.Model):
7 _inherit = 'report.stock.quantity'
8
9 _depends = {
10 'stock.quant': ['removal_date'],
11 }
12
13 def _get_product_qty_col(self):
14 # In case the quant is 'to be removed', only count the ones that are reserved as still being fresh
15 return "CASE WHEN q.removal_date IS NOT NULL AND q.removal_date::date <= (now() at time zone 'utc')::date AND date >= (now() at time zone 'utc')::date THEN q.reserved_quantity ELSE q.quantity END"