[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) <anv@odoo.com>
This commit is contained in:
committed by
Antoine Vandevenne (anv)
parent
1ac7b728cb
commit
8e4e8eb81a
@@ -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',
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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']
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<template id="account_payment_onboarding_panel" inherit_id="account.account_invoice_onboarding_panel" priority="30">
|
||||
<xpath expr="//t[@name='create_invoice_step']" position="after">
|
||||
<t t-call="account_payment.payment_onboarding_step" name="payment_step"/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="payment_onboarding_step" name="Payment Onboarding Step">
|
||||
<t t-call="base.onboarding_step">
|
||||
<t t-set="title">Online Payments</t>
|
||||
<t t-set="description">Enable credit & debit card payments supported by Stripe</t>
|
||||
<t t-set="btn_text">Activate Stripe</t>
|
||||
<t t-set="done_text">Online payments enabled</t>
|
||||
<t t-set="model" t-value="'res.company'"/>
|
||||
<t t-set="method" t-value="'action_open_payment_onboarding'"/>
|
||||
<t t-set="state" t-value="state.get('payment_provider_onboarding_state')"/>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user