[IMP] account_statement_base: Remove unnecessary code
Unnecessary code when merging https://github.com/odoo/odoo/pull/182497pull/754/head
parent
e8d1521127
commit
f42cbd11b1
|
@ -4,25 +4,6 @@ from odoo import _, models
|
||||||
class AccountBankStatement(models.Model):
|
class AccountBankStatement(models.Model):
|
||||||
_inherit = "account.bank.statement"
|
_inherit = "account.bank.statement"
|
||||||
|
|
||||||
# TODO: Delete if merged https://github.com/odoo/odoo/pull/182497
|
|
||||||
def _compute_date_index(self):
|
|
||||||
"""The super() method does not take into account lines that do not have
|
|
||||||
internal_index set yet, and causes sorted() to fail, we need to re-define
|
|
||||||
the method in these cases to avoid the error.
|
|
||||||
"""
|
|
||||||
_self = self
|
|
||||||
for stmt in self:
|
|
||||||
if any(not line.internal_index for line in stmt.line_ids):
|
|
||||||
_self -= stmt
|
|
||||||
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
|
|
||||||
return super(AccountBankStatement, _self)._compute_date_index()
|
|
||||||
|
|
||||||
def action_open_statement_lines(self):
|
def action_open_statement_lines(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if not self:
|
if not self:
|
||||||
|
|
|
@ -7,13 +7,6 @@ from odoo import models
|
||||||
class AccountBankStatementLine(models.Model):
|
class AccountBankStatementLine(models.Model):
|
||||||
_inherit = "account.bank.statement.line"
|
_inherit = "account.bank.statement.line"
|
||||||
|
|
||||||
# TODO: Delete if merged https://github.com/odoo/odoo/pull/182497
|
|
||||||
def _compute_running_balance(self):
|
|
||||||
# We need to set value to all records because super() does not do it using sql.
|
|
||||||
for item in self:
|
|
||||||
item.running_balance = item.running_balance
|
|
||||||
return super()._compute_running_balance()
|
|
||||||
|
|
||||||
def action_open_journal_entry(self):
|
def action_open_journal_entry(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if not self:
|
if not self:
|
||||||
|
|
Loading…
Reference in New Issue