Skip to content
Snippets Groups Projects

Draft: Port to Odoo 16.

Closed Etienne Ferriere requested to merge topic/13.0/MO16-236 into branch/13.0
Compare and Show latest version
2 files
+ 2
59
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -18,8 +18,7 @@
#
##############################################################################
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from odoo import api, fields, models
class AccountingEntry(models.Model):
@@ -40,56 +39,3 @@
help="debit - credit",
store=True,
)
# XXX why is that done in this module?
def control_reconciliation_access(self):
"""Correct the controls performed by Odoo on accounting entries
before reconciliation, for these contain errors.
"""
if not self:
return True
# Perform all checks on lines
company_ids = set()
all_accounts = []
partners = set()
for line in self:
company_ids.add(line.company_id.id)
all_accounts.append(line.account_id)
partners.add(line.partner_id.id)
if len(company_ids) > 1:
raise UserError(
_(
"To reconcile the entries company should be the same for "
"all entries!"
)
)
partners.discard(False)
if len(set(all_accounts)) > 1:
raise UserError(_("Entries are not of the same account!"))
if not (
all_accounts[0].reconcile or all_accounts[0].internal_type == "liquidity"
):
raise UserError(
_("The account %(name)s (%(code)s) is not marked as " "reconciliable!")
% {"name": all_accounts[0].name, "code": all_accounts[0].code}
)
return True
def reconcile(self, writeoff_acc_id=False, writeoff_journal_id=False):
self.control_reconciliation_access()
return super().reconcile(
writeoff_acc_id=writeoff_acc_id,
writeoff_journal_id=writeoff_journal_id,
)
def force_full_reconcile(self):
self.control_reconciliation_access()
return super().force_full_reconcile()
Loading