diff --git a/__init__.py b/__init__.py
index d9b70df15a..1020d96dca 100644
--- a/__init__.py
+++ b/__init__.py
@@ -4,6 +4,7 @@ from trytond.pool import Pool
from . import payment
from . import account
from . import statement
+from . import ir
def register():
@@ -12,6 +13,7 @@ def register():
payment.Payment,
payment.SucceedStart,
account.Move,
+ ir.Cron,
module='account_payment_clearing', type_='model')
Pool.register(
statement.Statement,
diff --git a/ir.py b/ir.py
new file mode 100644
index 0000000000..b5b31c8add
--- /dev/null
+++ b/ir.py
@@ -0,0 +1,14 @@
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
+from trytond.pool import PoolMeta
+
+
+class Cron(metaclass=PoolMeta):
+ __name__ = 'ir.cron'
+
+ @classmethod
+ def __setup__(cls):
+ super().__setup__()
+ cls.method.selection.append(
+ ('account.payment.journal|cron_post_clearing_moves',
+ "Post Clearing Moves"))
diff --git a/payment.py b/payment.py
index 2eda57dd05..da46bbe313 100644
--- a/payment.py
+++ b/payment.py
@@ -47,6 +47,7 @@ class Journal(metaclass=PoolMeta):
('origin.journal.id', '=', journal.id,
'account.payment'),
('state', '=', 'draft'),
+ ('company', '=', Transaction().context.get('company')),
]))
Move.post(moves)
diff --git a/payment.xml b/payment.xml
index 39cdf0e5c8..ba58a46ca8 100644
--- a/payment.xml
+++ b/payment.xml
@@ -39,32 +39,10 @@ this repository contains the full copyright notices and license terms. -->
-
- user_cron_post_clearing_moves
- Cron Post Clearing Moves
-
-
-
-
-
-
-
-
-
-
-
-
- Post Clearing Moves
-
-
+ account.payment.journal|cron_post_clearing_moves
days
-
- account.payment.journal
- cron_post_clearing_moves
diff --git a/tests/scenario_account_payment_clearing.rst b/tests/scenario_account_payment_clearing.rst
index 361c8fa9cb..5b7521e4d0 100644
--- a/tests/scenario_account_payment_clearing.rst
+++ b/tests/scenario_account_payment_clearing.rst
@@ -195,8 +195,8 @@ Succeed payment and post clearing::
>>> Cron = Model.get('ir.cron')
>>> Company = Model.get('company.company')
>>> cron_post_clearing_moves, = Cron.find([
- ... ('model', '=', 'account.payment.journal'),
- ... ('function', '=', 'cron_post_clearing_moves'),
+ ... ('method', '=',
+ ... 'account.payment.journal|cron_post_clearing_moves'),
... ])
>>> cron_post_clearing_moves.companies.append(Company(company.id))
>>> cron_post_clearing_moves.click('run_once')