Skip to content
  • Denis Ledoux's avatar
    [FIX] account: bank statement lines order on write · 9e624671
    Denis Ledoux authored
    When adding new lines to an existing statement,
    the order of the lines was not kept,
    due to the re-sequencing operation done in the
    override of `write` in `account.bank.statement`:
    
    ```
    for statement in self.browse(cr, uid, ids, context):
        for idx, line in enumerate(statement.line_ids):
            account_bank_statement_line_obj.write(cr, uid, [line.id], {'sequence': idx + 1}, context=context)
    ```
    as the lines order was based on `statement_id desc, sequence`,
    which is the same for all lines added,
    (except if the order is forced in the web client,
    using the handle widget)
    and, therefore, the order
    of the lines returned by `statement.line_ids` was
    not determinist.
    
    Adding the `id` to the lines order
    (as it's done in `sale.order`, for instance),
    solves the issue, as the lines will then be fetched
    in the order they were created.
    
    opw-667541
    9e624671