From 8e4e8eb81a6a4beeadecd1abcf58daeb71291046 Mon Sep 17 00:00:00 2001 From: "Anita (anko)" Date: Wed, 1 Mar 2023 16:04:38 +0000 Subject: [PATCH] [IMP] account_payment: add payment onboarding step To improve onboarding experience, configuring Stripe has been added in Invoice onboarding process. For db with other apps(ecommerce or sales) if onboarding is done in one place it is considered done in other places with exclusion of Sales, unless it was done in Sales. task-3208045 closes odoo/odoo#114131 Signed-off-by: Antoine Vandevenne (anv) --- addons/account_payment/__manifest__.py | 1 + addons/account_payment/models/__init__.py | 1 + addons/account_payment/models/res_company.py | 19 ++++++++++++++++ .../views/onboarding_templates.xml | 22 +++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 addons/account_payment/models/res_company.py create mode 100644 addons/account_payment/views/onboarding_templates.xml diff --git a/addons/account_payment/__manifest__.py b/addons/account_payment/__manifest__.py index 8b5068b930c..dbcec3696bc 100644 --- a/addons/account_payment/__manifest__.py +++ b/addons/account_payment/__manifest__.py @@ -19,6 +19,7 @@ 'views/account_move_views.xml', 'views/account_journal_views.xml', 'views/account_payment_views.xml', + 'views/onboarding_templates.xml', 'views/payment_provider_views.xml', 'views/payment_transaction_views.xml', diff --git a/addons/account_payment/models/__init__.py b/addons/account_payment/models/__init__.py index 1a548501a06..b3efe32217f 100644 --- a/addons/account_payment/models/__init__.py +++ b/addons/account_payment/models/__init__.py @@ -7,3 +7,4 @@ from . import account_payment_method from . import account_payment_method_line from . import payment_provider from . import payment_transaction +from . import res_company diff --git a/addons/account_payment/models/res_company.py b/addons/account_payment/models/res_company.py new file mode 100644 index 00000000000..2ed14af310c --- /dev/null +++ b/addons/account_payment/models/res_company.py @@ -0,0 +1,19 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, models + + +class ResCompany(models.Model): + _inherit = 'res.company' + + @api.model + def action_open_payment_onboarding(self): + self.env.company.payment_onboarding_payment_method = 'stripe' + menu = self.env.ref('account_payment.payment_provider_menu', raise_if_not_found=False) + menu_id = menu and menu.id + return self._run_payment_onboarding_step(menu_id) + + def get_account_invoice_onboarding_steps_states_names(self): + """ Override of `account` to add the state of the payment onboarding step. """ + steps = super().get_account_invoice_onboarding_steps_states_names() + return steps + ['payment_provider_onboarding_state'] diff --git a/addons/account_payment/views/onboarding_templates.xml b/addons/account_payment/views/onboarding_templates.xml new file mode 100644 index 00000000000..8485c35c26b --- /dev/null +++ b/addons/account_payment/views/onboarding_templates.xml @@ -0,0 +1,22 @@ + + + + + + + +