diff --git a/modules/account/CHANGELOG b/modules/account/CHANGELOG
index a230c6c6c7..4b4c8d414e 100644
--- a/modules/account/CHANGELOG
+++ b/modules/account/CHANGELOG
@@ -1,3 +1,4 @@
+* Add reconcile and unreconcile from general ledger lines
* Always raise exception when fiscal year or period are not found
* Remove support for Python 3.7
* Add support for Python 3.11
diff --git a/modules/account/account.py b/modules/account/account.py
index 48ce0cad3e..f60f2429e6 100644
--- a/modules/account/account.py
+++ b/modules/account/account.py
@@ -2460,6 +2460,13 @@ class GeneralLedgerLine(ModelSQL, ModelView):
account_parties[record_id] = id_
return account_parties
+ @classmethod
+ def reconcile(cls, *lines_list, **kwargs):
+ pool = Pool()
+ Line = pool.get('account.move.line')
+ lines_list = [Line.browse(l) for l in lines_list]
+ return Line.reconcile(*lines_list, **kwargs)
+
class GeneralLedgerLineContext(GeneralLedgerAccountContext):
'General Ledger Line Context'
diff --git a/modules/account/move.py b/modules/account/move.py
index 1aef48354c..3e92d2d30c 100644
--- a/modules/account/move.py
+++ b/modules/account/move.py
@@ -1840,6 +1840,21 @@ class ReconcileLines(Wizard):
])
reconcile = StateTransition()
+ @classmethod
+ def check_access(cls, models=None):
+ transaction = Transaction()
+ if transaction.user:
+ context = transaction.context
+ models = set() if models is None else models.copy()
+ models.update({'account.move.line', 'account.general_ledger.line'})
+ model = context.get('active_model')
+ if model and model not in models:
+ raise AccessError(gettext(
+ 'ir.msg_access_wizard_model_error',
+ wizard=cls.__name__,
+ model=model))
+ super().check_access()
+
def get_writeoff(self):
"Return writeoff amount and company"
company = None
@@ -1880,6 +1895,21 @@ class UnreconcileLines(Wizard):
start_state = 'unreconcile'
unreconcile = StateTransition()
+ @classmethod
+ def check_access(cls, models=None):
+ transaction = Transaction()
+ if transaction.user:
+ context = transaction.context
+ models = set() if models is None else models.copy()
+ models.update({'account.move.line', 'account.general_ledger.line'})
+ model = context.get('active_model')
+ if model and model not in models:
+ raise AccessError(gettext(
+ 'ir.msg_access_wizard_model_error',
+ wizard=cls.__name__,
+ model=model))
+ super().check_access()
+
def transition_unreconcile(self):
self.make_unreconciliation(self.records)
return 'end'
diff --git a/modules/account/move.xml b/modules/account/move.xml
index 12e8cb2381..3e71baf327 100644
--- a/modules/account/move.xml
+++ b/modules/account/move.xml
@@ -310,25 +310,34 @@ this repository contains the full copyright notices and license terms. -->
Reconcile Lines
account.move.reconcile_lines
- account.move.line
+
form_action
account.move.line,-1
-
+
+ form_action
+ account.general_ledger.line,-1
+
+
Unreconcile Lines
account.move.unreconcile_lines
- account.move.line
+
form_action
account.move.line,-1
+
+ form_action
+ account.general_ledger.line,-1
+
+
Reconcile Accounts
diff --git a/modules/account/tests/scenario_account_reconciliation.rst b/modules/account/tests/scenario_account_reconciliation.rst
index d35b1f7d6f..514818b01e 100644
--- a/modules/account/tests/scenario_account_reconciliation.rst
+++ b/modules/account/tests/scenario_account_reconciliation.rst
@@ -16,6 +16,8 @@ Activate modules::
>>> config = activate_modules('account')
+ >>> GLLine = Model.get('account.general_ledger.line')
+
Create company::
>>> _ = create_company()
@@ -92,6 +94,41 @@ Reconcile Lines without writeoff::
>>> len(reconcile1.reconciliation.lines)
2
+Unreconcile lines::
+
+ >>> unreconcile_lines = Wizard(
+ ... 'account.move.unreconcile_lines', [reconcile1])
+ >>> unreconcile_lines.state == 'end'
+ True
+ >>> reconcile1.reload()
+ >>> reconcile1.reconciliation
+ >>> reconcile2.reload()
+ >>> reconcile2.reconciliation
+
+Reconcile general ledger lines::
+
+ >>> gl_reconcile1 = GLLine(reconcile1.id)
+ >>> gl_reconcile2 = GLLine(reconcile2.id)
+ >>> reconcile_lines = Wizard('account.move.reconcile_lines',
+ ... [gl_reconcile1, gl_reconcile2])
+ >>> reconcile_lines.state == 'end'
+ True
+ >>> gl_reconcile1.reload()
+ >>> gl_reconcile2.reload()
+ >>> gl_reconcile1.reconciliation == gl_reconcile2.reconciliation != None
+ True
+
+Unreconcile general ledger, lines::
+
+ >>> unreconcile_lines = Wizard(
+ ... 'account.move.unreconcile_lines', [gl_reconcile1])
+ >>> unreconcile_lines.state == 'end'
+ True
+ >>> gl_reconcile1.reload()
+ >>> gl_reconcile1.reconciliation
+ >>> gl_reconcile2.reload()
+ >>> gl_reconcile2.reconciliation
+
Create Moves for writeoff reconciliation::
>>> move = Move()