[FIX] account: reconcile older invoices first
Often an invoice with the same amount is send to the same customer every week/month. If the customer pays just the amount, without any matching invoice information, common practice is to take the oldest invoice first. Odoo currently suggests the invoice with the highest due date. After the fix Odoo will suggest the invoice with the lowest due date. closes odoo/odoo#32334 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit is contained in:
committed by
support@claresco.nl
parent
e987270978
commit
436eb69450
@@ -658,7 +658,7 @@ class AccountBankStatementLine(models.Model):
|
||||
liquidity_amt_clause = currency and '%(amount)s::numeric' or 'abs(%(amount)s::numeric)'
|
||||
sql_query = self._get_common_sql_query(excluded_ids=excluded_ids) + \
|
||||
" AND ("+field+" = %(amount)s::numeric OR (acc.internal_type = 'liquidity' AND "+liquidity_field+" = " + liquidity_amt_clause + ")) \
|
||||
ORDER BY date_maturity desc, aml.id desc LIMIT 1"
|
||||
ORDER BY date_maturity asc, aml.id desc LIMIT 1"
|
||||
self.env.cr.execute(sql_query, params)
|
||||
results = self.env.cr.fetchone()
|
||||
if results:
|
||||
|
||||
Reference in New Issue
Block a user