Skip to content
  • Pedro M. Baeza's avatar
    [FIX] account: Proper query in invoice reconcile model · 34250482
    Pedro M. Baeza authored
    
    
    If `past_months_limit` is set in the invoice reconcile model, and some
    `exclude_ids` are indicated on the call to `_get_invoice_matching_query`,
    an invalid SQL is built, throwing this error:
    
    odoo_1  | Traceback (most recent call last):
    odoo_1  |   File "/opt/odoo/custom/src/odoo/odoo/http.py", line 652, in _handle_exception
    odoo_1  |     return super(JsonRequest, self)._handle_exception(exception)
    odoo_1  |   File "/opt/odoo/custom/src/odoo/odoo/http.py", line 317, in _handle_exception
    odoo_1  |     raise exception.with_traceback(None) from new_cause
    odoo_1  | psycopg2.errors.SyntaxError: syntax error at or near "aml"
    odoo_1  | LINE 25: ...id = 2226)) AND aml.date >= '2022-04-22'::dateAND aml.id NOT...
    
    That's because the `past_months_limit` SQL condition is added without
    extra trailing space, and the excluded_ids condition doesn't contain
    an starting space.
    
    The solution is to add spaces to avoid this situation.
    
    closes odoo/odoo#139419
    
    Signed-off-by: default avatarde Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
    34250482
Loading