[ADD] account_bank_statement_reopen_shop_undo_reconciliation

This commit is contained in:
Jordi Ballester
2022-09-18 20:32:40 +02:00
parent 23fc8cba94
commit e596d14b0d
16 changed files with 645 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
from . import account_bank_statement
from . import account_bank_statement_line
from . import account_move_line
from . import account_move

View File

@@ -0,0 +1,15 @@
# Copyright 2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# Copyright 2022 ForgeFlow S.L.
# @author Jordi Ballester <jordi.ballester@forgeflow.com.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models
class AccountBankStatement(models.Model):
_inherit = "account.bank.statement"
def button_reopen(self):
self = self.with_context(skip_undo_reconciliation=True)
return super(AccountBankStatement, self).button_reopen()

View File

@@ -0,0 +1,20 @@
# Copyright 2022 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# Copyright 2022 ForgeFlow S.L.
# @author Jordi Ballester <jordi.ballester@forgeflow.com.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models
class AccountBankStatementLine(models.Model):
_inherit = "account.bank.statement.line"
def button_undo_reconciliation(self):
if self._context.get("skip_undo_reconciliation"):
return
res = super(AccountBankStatementLine, self).button_undo_reconciliation()
if self.statement_id.state == "open":
self.move_id.button_draft()
return res

View File

@@ -0,0 +1,13 @@
# Copyright 2022 ForgeFlow S.L.
# @author Jordi Ballester <jordi.ballester@forgeflow.com.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models
class AccountMove(models.Model):
_inherit = "account.move"
def button_draft(self):
moves_to_draft = self.filtered(lambda m: not m.statement_line_id.is_reconciled)
return super(AccountMove, moves_to_draft).button_draft()

View File

@@ -0,0 +1,14 @@
# Copyright 2022 ForgeFlow S.L.
# @author Jordi Ballester <jordi.ballester@forgeflow.com.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
def remove_move_reconcile(self):
if self._context.get("skip_undo_reconciliation"):
return True
return super(AccountMoveLine, self).remove_move_reconcile()