summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwan <wan@odoo.com>2020-08-18 11:07:12 +0000
committerwan <wan@odoo.com>2020-08-19 16:04:01 +0000
commit4cf9fa928e2598aeb0a1bc881552952eb34787f1 (patch)
tree7bd4dfe4660cd223539df8794c19c279e0bc8f6a
parentfa02f0ba2109f68d9f66bec9bc4033b3f0d0ae69 (diff)
[IMP] account: redo the tour
The tour has been updated Task 2306134 closes odoo/odoo#55624 Related: odoo/enterprise#12378 Related: odoo/upgrade#1659 Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
-rw-r--r--addons/account/models/company.py67
-rw-r--r--addons/account/static/src/js/tours/account.js80
-rw-r--r--addons/account/tests/__init__.py1
-rw-r--r--addons/account/tests/test_tour.py15
-rw-r--r--addons/account/views/account_onboarding_templates.xml45
-rw-r--r--addons/payment/views/payment_acquirer_onboarding_templates.xml8
6 files changed, 97 insertions, 119 deletions
diff --git a/addons/account/models/company.py b/addons/account/models/company.py
index 29b4c8b64cc..cf1b2d541b3 100644
--- a/addons/account/models/company.py
+++ b/addons/account/models/company.py
@@ -97,7 +97,7 @@ class ResCompany(models.Model):
account_setup_fy_data_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding fiscal year step", default='not_done')
account_setup_coa_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding charts of account step", default='not_done')
account_onboarding_invoice_layout_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding invoice layout step", default='not_done')
- account_onboarding_sample_invoice_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding sample invoice step", default='not_done')
+ account_onboarding_create_invoice_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding create invoice step", default='not_done')
account_onboarding_sale_tax_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding sale tax step", default='not_done')
# account dashboard onboarding
@@ -168,7 +168,7 @@ class ResCompany(models.Model):
return [
'base_onboarding_company_state',
'account_onboarding_invoice_layout_state',
- 'account_onboarding_sample_invoice_state',
+ 'account_onboarding_create_invoice_state',
]
def get_and_update_account_dashboard_onboarding_state(self):
@@ -437,67 +437,8 @@ class ResCompany(models.Model):
return action
@api.model
- def _get_sample_invoice(self):
- """ Get a sample invoice or create one if it does not exist. """
- # use current user as partner
- partner = self.env.user.partner_id
-
- company_id = self.env.company.id
- # try to find an existing sample invoice
- sample_invoice = self.env['account.move'].search(
- [('company_id', '=', company_id),
- ('partner_id', '=', partner.id)], limit=1)
-
- if len(sample_invoice) == 0:
- # If there are no existing accounts or no journal, fail
- account = self.env.company.get_chart_of_accounts_or_fail()
-
- journal = self.env['account.journal'].search([('company_id', '=', company_id)], limit=1)
- if len(journal) == 0:
- action = self.env.ref('account.action_account_journal_form')
- msg = _("We cannot find any journal for this company. You should create one."
- "\nPlease go to Configuration > Journals.")
- raise RedirectWarning(msg, action.id, _("Go to the journal configuration"))
-
- account = journal.default_credit_account_id or account
- sample_invoice = self.env['account.move'].with_context(default_move_type='out_invoice', default_journal_id=journal.id).create({
- 'payment_reference': _('Sample invoice'),
- 'partner_id': partner.id,
- 'invoice_line_ids': [
- (0, 0, {
- 'name': _('Sample invoice line name'),
- 'account_id': account.id,
- 'quantity': 2,
- 'price_unit': 199.99,
- }),
- (0, 0, {
- 'name': _('Sample invoice line name 2'),
- 'account_id': account.id,
- 'quantity': 1,
- 'price_unit': 25.0,
- }),
- ],
- })
- return sample_invoice
-
- @api.model
- def action_open_account_onboarding_sample_invoice(self):
- """ Onboarding step for sending a sample invoice. Open a window to compose an email,
- with the edi_invoice_template message loaded by default. """
- sample_invoice = self._get_sample_invoice()
- template = self.env.ref('account.email_template_edi_invoice', False)
- action = self.env["ir.actions.actions"]._for_xml_id("account.action_open_account_onboarding_sample_invoice")
- action['context'] = {
- 'default_res_id': sample_invoice.id,
- 'default_use_template': bool(template),
- 'default_template_id': template and template.id or False,
- 'default_model': 'account.move',
- 'default_composition_mode': 'comment',
- 'mark_invoice_as_sent': True,
- 'custom_layout': 'mail.mail_notification_borders',
- 'force_email': True,
- 'mail_notify_author': True,
- }
+ def action_open_account_onboarding_create_invoice(self):
+ action = self.env["ir.actions.actions"]._for_xml_id("account.action_open_account_onboarding_create_invoice")
return action
def action_save_onboarding_invoice_layout(self):
diff --git a/addons/account/static/src/js/tours/account.js b/addons/account/static/src/js/tours/account.js
index 74b0dcda95b..0b4365ce23e 100644
--- a/addons/account/static/src/js/tours/account.js
+++ b/addons/account/static/src/js/tours/account.js
@@ -7,21 +7,69 @@ var tour = require('web_tour.tour');
var _t = core._t;
tour.register('account_tour', {
- 'skip_enabled': true,
-}, [{
- trigger: ".o_form_readonly .o_invoice_validate",
- extra_trigger: '.o_invoice_form',
- content: _t("Click to <b>validate your invoice.</b> A reference will be assigned to this invoice and you will not be able to modify it anymore."),
- position: "right"
-}, {
- trigger: ".o_invoice_send",
- extra_trigger: '.o_invoice_form',
- content: _t("Click to <b>send the invoice by email.</b>"),
- position: "bottom"
-}, {
- trigger: ".o_mail_send",
- content: _t("Click to <b>send the invoice.</b>"),
- position: "bottom"
-} ]);
+ skip_enabled: true,
+ url: "/web",
+}, [
+ ...tour.stepUtils.goToAppSteps('account.menu_finance', _t('Send invoices to your customers in no time with the <b>Invoicing app</b>.')),
+ {
+ trigger: "a.o_onboarding_step_action[data-method=action_open_base_onboarding_company]",
+ content: _t("Start by checking your company's data."),
+ }, {
+ trigger: "button[name=action_save_onboarding_company_step]",
+ content: _t("Looks good. Let's continue."),
+ }, {
+ trigger: "a.o_onboarding_step_action[data-method=action_open_base_document_layout]",
+ content: _t("Customize your layout."),
+ }, {
+ trigger: "button[name=document_layout_save]",
+ content: _t("Once everything is as you want it, validate."),
+ }, {
+ trigger: "a.o_onboarding_step_action[data-method=action_open_account_onboarding_create_invoice]",
+ content: _t("Now, we'll create a your first invoice."),
+ }, {
+ trigger: "input[name=name]",
+ content: _t("Customize the prefix and number to fit your needs."),
+ run: 'text SALE/0000000001'
+ }, {
+ trigger: "div[name=partner_id] input",
+ content: _t("Write a company name to <b>create one</b> or <b>see suggestions</b>."),
+ position: "bottom",
+ }, {
+ trigger: ".o_m2o_dropdown_option a:contains('Create')",
+ content: _t("Select first partner"),
+ auto: true,
+ }, {
+ trigger: ".modal-content button.btn-primary",
+ content: _t("Once everything is set, you are good to continue. You will be able to edit this later in the <b>Customers</b> menu."),
+ }, {
+ trigger: "div[name=invoice_line_ids] .o_field_x2many_list_row_add a:not([data-context])",
+ content: _t("Add a line to your invoice"),
+ }, {
+ trigger: "div[name=invoice_line_ids] textarea[name=name]",
+ content: _t("Fill in the details of the line.<br><i>Tip: all the details can be set automatically if you configure your <b>products</b>.</i>"),
+ position: "bottom",
+ }, {
+ trigger: "div[name=invoice_line_ids] input[name=price_unit]",
+ content: _t("Set a price"),
+ position: "bottom",
+ run: 'text 100',
+ }, {
+ trigger: "button[name=action_post]",
+ content: _t("Once your invoice is ready, validate."),
+ }, {
+ trigger: "button[name=action_invoice_sent]",
+ content: _t("Send the invoice and check what the customer will receive."),
+ }, {
+ trigger: "input[name=email]",
+ content: _t("Write here <b>your own email address</b> to test the flow."),
+ run: 'text customer@example.com',
+ }, {
+ trigger: ".modal-content button.btn-primary",
+ content: _t("Validate."),
+ }, {
+ trigger: "button[name=send_and_print_action]",
+ content: _t("Let's send the invoice."),
+ }
+]);
});
diff --git a/addons/account/tests/__init__.py b/addons/account/tests/__init__.py
index 8e09703a225..4936b997dbc 100644
--- a/addons/account/tests/__init__.py
+++ b/addons/account/tests/__init__.py
@@ -31,3 +31,4 @@ from . import test_tax_report
from . import test_transfer_wizard
from . import test_account_incoming_supplier_invoice
from . import test_account_payment_register
+from . import test_tour
diff --git a/addons/account/tests/test_tour.py b/addons/account/tests/test_tour.py
new file mode 100644
index 00000000000..8dc70195f36
--- /dev/null
+++ b/addons/account/tests/test_tour.py
@@ -0,0 +1,15 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+import odoo.tests
+
+
+@odoo.tests.tagged('post_install', '-at_install')
+class TestUi(odoo.tests.HttpCase):
+
+ def test_01_account_tour(self):
+ # This tour doesn't work with demo data on runbot
+ all_moves = self.env['account.move'].search([('move_type', '!=', 'entry')])
+ all_moves.button_draft()
+ all_moves.posted_before = False
+ all_moves.unlink()
+ self.start_tour("/web", 'account_tour', login="admin")
diff --git a/addons/account/views/account_onboarding_templates.xml b/addons/account/views/account_onboarding_templates.xml
index 353cdce152c..67bd9481373 100644
--- a/addons/account/views/account_onboarding_templates.xml
+++ b/addons/account/views/account_onboarding_templates.xml
@@ -13,17 +13,17 @@
<t t-set="state" t-value="state.get('account_onboarding_invoice_layout_state')" />
</t>
</template>
- <template id="onboarding_sample_invoice_step">
+ <template id="onboarding_create_invoice_step">
<t t-call="base.onboarding_step">
- <t t-set="title">Sample Invoice</t>
+ <t t-set="title">Create Invoice</t>
<t t-set="description">
- Send an invoice to test the customer portal.
+ Create your first invoice.
</t>
- <t t-set="btn_text">Send sample</t>
- <t t-set="done_text">Sample invoice sent!</t>
- <t t-set="method" t-value="'action_open_account_onboarding_sample_invoice'" />
+ <t t-set="btn_text">Create</t>
+ <t t-set="done_text">First invoice sent!</t>
+ <t t-set="method" t-value="'action_open_account_onboarding_create_invoice'" />
<t t-set="model" t-value="'res.company'" />
- <t t-set="state" t-value="state.get('account_onboarding_sample_invoice_state')" />
+ <t t-set="state" t-value="state.get('account_onboarding_create_invoice_state')" />
</t>
</template>
<template id="onboarding_bank_account_step">
@@ -81,7 +81,7 @@
<t t-call="base.onboarding_company_step" name="company_step" />
<t t-call="account.onboarding_invoice_layout_step" name="invoice_layout_step" />
- <t t-call="account.onboarding_sample_invoice_step" name="sample_invoice_step" />
+ <t t-call="account.onboarding_create_invoice_step" name="create_invoice_step" />
</t>
</template>
<template id="account_dashboard_onboarding_panel" name="account.dashboard.onboarding.panel">
@@ -98,32 +98,13 @@
</t>
</template>
<!-- SAMPLE INVOICE EMAIL -->
- <record model="ir.ui.view" id="email_compose_onboarding_sample_invoice">
- <field name="name">mail.compose.message.form.account_invoice_onboarding_sample_invoice
- </field>
- <field name="model">mail.compose.message</field>
- <field name="inherit_id" ref="mail.email_compose_message_wizard_form" />
- <field name="priority">1000</field>
- <field name="mode">primary</field>
- <field name="arch" type="xml">
- <xpath expr="//span[@name='document_followers_text']" position="attributes">
- <attribute name="invisible">1</attribute>
- </xpath>
- <xpath expr="//button[@name='save_as_template']" position="attributes">
- <attribute name="invisible">1</attribute>
- </xpath>
- <xpath expr="//field[@name='template_id']" position="attributes">
- <attribute name="invisible">1</attribute>
- </xpath>
- </field>
- </record>
- <record id="action_open_account_onboarding_sample_invoice" model="ir.actions.act_window">
- <field name="name">Send a sample invoice</field>
+ <record id="action_open_account_onboarding_create_invoice" model="ir.actions.act_window">
+ <field name="name">Create first invoice</field>
<field name="type">ir.actions.act_window</field>
- <field name="res_model">mail.compose.message</field>
+ <field name="res_model">account.move</field>
<field name="view_mode">form</field>
- <field name="view_id" ref="email_compose_onboarding_sample_invoice" />
- <field name="target">new</field>
+ <field name="view_id" ref="account.view_move_form" />
+ <field name="context">{'default_move_type': 'out_invoice'}</field>
</record>
<!-- SALE TAX -->
<template id="onboarding_sale_tax_step">
diff --git a/addons/payment/views/payment_acquirer_onboarding_templates.xml b/addons/payment/views/payment_acquirer_onboarding_templates.xml
index c2e68bb19d4..093992bd6d6 100644
--- a/addons/payment/views/payment_acquirer_onboarding_templates.xml
+++ b/addons/payment/views/payment_acquirer_onboarding_templates.xml
@@ -12,14 +12,6 @@
<t t-set="state" t-value="state.get('payment_acquirer_onboarding_state')" />
</t>
</template>
- <!-- add it in the account invoice onboarding panel -->
- <template id="account_invoice_payment_acquirer_onboarding"
- name="account invoice payment acquirer onboarding"
- inherit_id="account.account_invoice_onboarding_panel">
- <xpath expr="//t[@name='sample_invoice_step']" position="before">
- <t t-call="payment.onboarding_payment_acquirer_step" name="payment_acquirer_step" />
- </xpath>
- </template>
<!--PAYMENT ACQUIRER-->
<record model="ir.ui.view" id="payment_acquirer_onboarding_wizard_form">
<field name="name">payment.acquirer.onboarding.wizard.form</field>