Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Invoicing

Entity: account.bank.statement

Compute Method: _compute_date

View 18.0 View 20.0
Inputs Method Outputs
  • line_ids
  • date
- for stmt in self:
+ for statement in self:
            # When we create lines manually from the form view, they don't have any `internal_index` set yet.
-             sorted_lines = stmt.line_ids.filtered("internal_index").sorted('internal_index')
-             stmt.first_line_index = sorted_lines[:1].internal_index
-             stmt.date = sorted_lines.filtered(lambda l: l.state == 'posted')[-1:].date
+             sorted_lines = statement.line_ids.filtered('internal_index').sorted('internal_index')
+             statement.date = sorted_lines.filtered(lambda l: l.state == 'posted')[-1:].date or statement.date
  • first_line_index
  • date

Back to entity