diff --git a/__init__.py b/__init__.py index aa905bce4e..0fe24521ff 100644 --- a/__init__.py +++ b/__init__.py @@ -6,6 +6,7 @@ from trytond.pool import Pool from . import payment from . import party from . import routes +from . import ir __all__ = ['register', 'routes'] @@ -18,6 +19,7 @@ def register(): payment.Group, payment.Payment, party.Party, + ir.Cron, module='account_payment_stripe', type_='model') Pool.register( payment.Checkout, diff --git a/ir.py b/ir.py new file mode 100644 index 0000000000..90310715ab --- /dev/null +++ b/ir.py @@ -0,0 +1,19 @@ +# 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.extend([ + ('account.payment|stripe_charge', "Charge Stripe Payments"), + ('account.payment|stripe_capture_', "Capture Stripe Payments"), + ('account.payment.stripe.customer|stripe_create', + "Create Stripe Customer"), + ('account.payment.stripe.customer|stripe_delete', + "Delete Stripe Customer"), + ]) diff --git a/payment.py b/payment.py index 223f87a0c7..a0ed1ee530 100644 --- a/payment.py +++ b/payment.py @@ -365,6 +365,7 @@ class Payment(metaclass=PoolMeta): ('stripe_customer.stripe_customer_id', '!=', None), ], ('stripe_charge_id', '=', None), + ('company', '=', Transaction().context.get('company')), ]) for payment in payments: if (payment.stripe_charge_id @@ -443,6 +444,7 @@ class Payment(metaclass=PoolMeta): ('stripe_charge_id', '!=', None), ('stripe_captured', '=', False), ('stripe_capture', '=', True), + ('company', '=', Transaction().context.get('company')), ]) for payment in payments: if (not payment.stripe_charge_id diff --git a/payment.xml b/payment.xml index 930f9ccd43..f74082b706 100644 --- a/payment.xml +++ b/payment.xml @@ -181,66 +181,28 @@ this repository contains the full copyright notices and license terms. --> html - - user_cron_stripe - Cron Stripe - - - - - - - - Charge Stripe Payments - - - + account.payment|stripe_charge minutes - - - account.payment - stripe_charge - Capture Stripe Payments - - - + account.payment|stripe_capture_ minutes - - - account.payment - stripe_capture_ - Create Stripe Customer - - - + account.payment.stripe.customer|stripe_create hours - - - account.payment.stripe.customer - stripe_create - Delete Stripe Customer - - - + account.payment.stripe.customer|stripe_delete hours - - - account.payment.stripe.customer - stripe_delete