[ADD] website_sale: onboarding steps
Add new onboarding steps: payment and theme selector. There are initially used on the website_sale_dashboard onboarding panel. task: 38876
This commit is contained in:
committed by
Yannick Tivisse
parent
6671d3d72b
commit
19775de261
@@ -3,3 +3,4 @@
|
||||
|
||||
from . import controllers
|
||||
from . import models
|
||||
from . import wizard
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
'data/digest_data.xml',
|
||||
'views/product_views.xml',
|
||||
'views/account_views.xml',
|
||||
'views/onboarding_views.xml',
|
||||
'views/sale_report_views.xml',
|
||||
'views/sale_order_views.xml',
|
||||
'views/crm_team_views.xml',
|
||||
|
||||
@@ -12,3 +12,4 @@ from . import sale_order
|
||||
from . import website
|
||||
from . import res_config_settings
|
||||
from . import digest
|
||||
from . import res_company
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
website_sale_onboarding_payment_acquirer_done =\
|
||||
fields.Boolean("Website sale onboarding payment acquirer step done", default=False)
|
||||
|
||||
@api.model
|
||||
def action_open_website_sale_onboarding_payment_acquirer(self):
|
||||
""" Called by onboarding panel above the quotation list."""
|
||||
action = self.env.ref('website_sale.action_open_website_sale_onboarding_payment_acquirer_wizard').read()[0]
|
||||
return action
|
||||
@@ -0,0 +1,31 @@
|
||||
<odoo>
|
||||
<!-- PAYMENT ACQUIRER -->
|
||||
<template id="website_sale_onboarding_payment_acquirer_step" primary="True"
|
||||
inherit_id="payment.onboarding_payment_acquirer_step">
|
||||
<xpath expr="//t[@t-set='method']" position="replace">
|
||||
<t t-set="method" t-value="'action_open_website_sale_onboarding_payment_acquirer'" />
|
||||
</xpath>
|
||||
<xpath expr="//t[@t-set='done']" position="replace">
|
||||
<t t-set="done" t-value="company.website_sale_onboarding_payment_acquirer_done" />
|
||||
</xpath>
|
||||
</template>
|
||||
<record id="website_sale_onboarding_payment_acquirer_form" model="ir.ui.view">
|
||||
<field name="name">website.sale.onboarding.payment.acquirer.form</field>
|
||||
<field name="model">website.sale.payment.acquirer.onboarding.wizard</field>
|
||||
<field name="inherit_id" ref="payment.payment_acquirer_onboarding_wizard_form"/>
|
||||
<field name="mode">primary</field>
|
||||
<field name="priority">1000</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='skip_step_text']" position="replace"/>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_open_website_sale_onboarding_payment_acquirer_wizard" model="ir.actions.act_window">
|
||||
<field name="name">Choose a payment method</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">website.sale.payment.acquirer.onboarding.wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="website_sale_onboarding_payment_acquirer_form" />
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import payment_acquirer_onboarding_wizard
|
||||
@@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class PaymentWizard(models.TransientModel):
|
||||
_inherit = 'payment.acquirer.onboarding.wizard'
|
||||
_name = 'website.sale.payment.acquirer.onboarding.wizard'
|
||||
|
||||
def _set_payment_acquirer_onboarding_step_done(self):
|
||||
""" Override. """
|
||||
self.env.user.company_id.website_sale_onboarding_payment_acquirer_done = True
|
||||
@@ -1 +1,4 @@
|
||||
from . import models
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
from . import ir_module_module
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import ir_module_module
|
||||
from . import res_company
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
from ast import literal_eval
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
def _compute_website_theme_onboarding_done(self):
|
||||
""" The step is marked as done if one theme is installed. """
|
||||
# we need the same domain as the existing action
|
||||
action = self.env.ref('website_theme_install.theme_install_kanban_action').read()[0]
|
||||
domain = literal_eval(action['domain'])
|
||||
domain.append(('state', '=', 'installed'))
|
||||
installed_themes_count = self.env['ir.module.module'].sudo().search_count(domain)
|
||||
for record in self:
|
||||
record.website_theme_onboarding_done = (installed_themes_count > 0)
|
||||
|
||||
website_theme_onboarding_done = fields.Boolean("Onboarding website theme step done",
|
||||
compute='_compute_website_theme_onboarding_done')
|
||||
|
||||
@api.model
|
||||
def action_open_website_theme_selector(self):
|
||||
action = self.env.ref('website_theme_install.theme_install_kanban_action').read()[0]
|
||||
action['target'] = 'new'
|
||||
return action
|
||||
@@ -95,4 +95,15 @@ action = {
|
||||
<a href="/web#action=website_theme_install.theme_install_kanban_action">See themes here</a>
|
||||
</xpath>
|
||||
</template>
|
||||
<!-- ONBOARDING -->
|
||||
<template id="onboarding_website_theme_step">
|
||||
<t t-call="base.onboarding_step">
|
||||
<t t-set="title">Website Theme</t>
|
||||
<t t-set="description">Select a theme for your wonderful website.</t>
|
||||
<t t-set="btn_text">Let's start!</t>
|
||||
<t t-set="method" t-value="'action_open_website_theme_selector'" />
|
||||
<t t-set="model" t-value="'res.company'" />
|
||||
<t t-set="done" t-value="company.website_theme_onboarding_done" />
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user