[FIX] product_expiry: filter quants by expiration alert date

Steps to reproduce the bug:
- Enable “Expiration date” in inventory settings
- Create a Storable product “P1”
    - Tracking: by serial number
    - Enable the expiration date option
    - Update the quantity:
        - Create a new Lot “SN1”:
            - select today's date as the alert date

- Go to inventory > reporting > Inventory Report
- Try to filter by “Expiration Alerts”

Problem:
The product P1 is not selected, because the filter checks the removal
date instead of the alert date

Solution:
The filter should check if the alert date is less than or equal
to today's date to display products or not, as it is for lots:
https://github.com/odoo/odoo/blob/14.0/addons/product_expiry/views/production_lot_views.xml#L30-L39

opw-2889737

closes odoo/odoo#95289

X-original-commit: 1c04bc5407f02c7299b86a7f4fef207f4aa01c77
Signed-off-by: Christophe Simonis <chs@odoo.com>
This commit is contained in:
Touati Djamel (otd)
2022-07-05 11:35:25 +02:00
parent e37a663b52
commit 024ee89678
@@ -37,7 +37,7 @@
<xpath expr="//filter[@name='reserved']" position="after">
<separator/>
<filter string="Expiration Alerts" name="expiration_alerts"
domain="[('removal_date', '&lt;=', context_today().strftime('%Y-%m-%d'))]"/>
domain="[('lot_id.alert_date', '&lt;=', context_today().strftime('%Y-%m-%d'))]"/>
</xpath>
</field>
</record>