diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py index 02d00494814..e78ffc3a7b2 100644 --- a/addons/account/__manifest__.py +++ b/addons/account/__manifest__.py @@ -14,7 +14,7 @@ You could use this simplified accounting in case you work with an (external) acc """, 'category': 'Accounting/Accounting', 'website': 'https://www.odoo.com/app/invoicing', - 'depends' : ['base_setup', 'product', 'analytic', 'portal', 'digest'], + 'depends': ['base_setup', 'onboarding', 'product', 'analytic', 'portal', 'digest'], 'data': [ 'security/account_security.xml', 'security/ir.model.access.csv', @@ -22,6 +22,7 @@ You could use this simplified accounting in case you work with an (external) acc 'data/digest_data.xml', 'views/account_report.xml', 'data/mail_template_data.xml', + 'data/onboarding_data.xml', 'views/account_payment_view.xml', 'wizard/account_automatic_entry_wizard_views.xml', 'wizard/account_unreconcile_view.xml', @@ -59,7 +60,6 @@ You could use this simplified accounting in case you work with an (external) acc 'views/account_journal_dashboard_view.xml', 'views/account_portal_templates.xml', 'views/report_payment_receipt_templates.xml', - 'views/account_onboarding_templates.xml', 'data/service_cron.xml', 'views/account_incoterms_view.xml', 'data/account_incoterms_data.xml', @@ -94,6 +94,7 @@ You could use this simplified accounting in case you work with an (external) acc 'account/static/src/components/**/*', 'account/static/src/js/tours/account.js', 'account/static/src/xml/**/*', + 'account/static/src/views/**/*.js', ], 'web.assets_frontend': [ 'account/static/src/js/account_portal_sidebar.js', diff --git a/addons/account/controllers/__init__.py b/addons/account/controllers/__init__.py index 4cb0be3e577..44eea6b8e43 100644 --- a/addons/account/controllers/__init__.py +++ b/addons/account/controllers/__init__.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import onboarding from . import portal from . import terms diff --git a/addons/account/controllers/onboarding.py b/addons/account/controllers/onboarding.py deleted file mode 100644 index 240d7aef2f6..00000000000 --- a/addons/account/controllers/onboarding.py +++ /dev/null @@ -1,49 +0,0 @@ -from odoo import http -from odoo.http import request - - -class OnboardingController(http.Controller): - - @http.route('/account/account_invoice_onboarding', auth='user', type='json') - def account_invoice_onboarding(self, context=None): - """ Returns the `banner` for the account invoice onboarding panel. - It can be empty if the user has closed it or if he doesn't have - the permission to see it. """ - - # Forward `allowed_company_ids` in the context - # so `request.env.company` returns the company selected in the dropdown - if context: - request.update_context(**context) - company = request.env.company - if not request.env.is_admin() or \ - company.account_invoice_onboarding_state == 'closed': - return {} - - return { - 'html': request.env['ir.qweb']._render('account.account_invoice_onboarding_panel', { - 'company': company, - 'state': company.get_and_update_account_invoice_onboarding_state() - }) - } - - @http.route('/account/account_dashboard_onboarding', auth='user', type='json') - def account_dashboard_onboarding(self, context=None): - """ Returns the `banner` for the account dashboard onboarding panel. - It can be empty if the user has closed it or if he doesn't have - the permission to see it. """ - # Forward `allowed_company_ids` in the context - # so `request.env.company` returns the company selected in the dropdown - if context: - request.update_context(**context) - company = request.env.company - - if not request.env.is_admin() or \ - company.account_dashboard_onboarding_state == 'closed': - return {} - - return { - 'html': request.env['ir.qweb']._render('account.account_dashboard_onboarding_panel', { - 'company': company, - 'state': company.get_and_update_account_dashboard_onboarding_state() - }) - } diff --git a/addons/account/data/onboarding_data.xml b/addons/account/data/onboarding_data.xml new file mode 100644 index 00000000000..ca89a63521c --- /dev/null +++ b/addons/account/data/onboarding_data.xml @@ -0,0 +1,134 @@ + + + + + + + Company Data + Set your company's data for documents header/footer. + Let's start! + Looks great! + action_open_step_company_data + + onboarding_company-data.png + Onboarding Company Data + 1 + + + + Documents Layout + Customize the look of your documents. + Customize + Looks great! + action_open_step_base_document_layout + + onboarding_quotation-layout.png + Onboarding Documents Layout + 3 + + + + Create Invoice + Create your first invoice. + Create + First invoice sent! + action_open_step_create_invoice + + onboarding_default.png + Onboarding Create Invoice + 4 + + + + + Accounting Periods + Define your fiscal years & tax returns periodicity. + Configure + Step completed! + action_open_step_fiscal_year + + onboarding_accounting-periods.png + Onboarding Accounting Periods + 1 + + + + Bank Account + Connect your financial accounts in seconds. + Add a bank account + Step Completed! + action_open_step_bank_account + + onboarding_puzzle.png + Onboarding Bank Account + 2 + + + + Taxes + Set default Taxes for sales and purchase transactions. + Review + Taxes set! + action_open_step_default_taxes + + onboarding_taxes.png + Onboarding Taxes + 3 + + + + Chart of Accounts + Set up your chart of accounts and record initial balances. + Review + Chart of accounts set! + action_open_step_chart_of_accounts + + onboarding_chart-of-accounts.png + Onboarding Bank Account + 4 + + + + + Import Vendor Bills + 1000 + + + + Taxes + + Choose a default sales tax for your products. + Set taxes + Step Completed! + action_open_step_sales_tax + + onboarding_puzzle.png + Onboarding Bank Account + 100 + + + + + Invoicing Onboarding + + account_invoice + action_close_panel_account_invoice + + + + Account Dashboard Onboarding + + account_dashboard + action_close_panel_account_dashboard + + + diff --git a/addons/account/models/__init__.py b/addons/account/models/__init__.py index dedb26f5e69..76f6bb8cb6e 100644 --- a/addons/account/models/__init__.py +++ b/addons/account/models/__init__.py @@ -37,5 +37,7 @@ from . import ir_actions_report from . import ir_module from . import res_currency from . import account_report +from . import onboarding_onboarding +from . import onboarding_onboarding_step from . import template_generic_coa from . import uom_uom diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 792655f8e9d..919e5128476 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -620,7 +620,7 @@ class account_journal(models.Model): """ This function is called by the "Import" button of Vendor Bills, visible on dashboard if no bill has been created yet. """ - self.env.company.sudo().set_onboarding_step_done('account_setup_bill_state') + self.env['onboarding.onboarding.step'].action_validate_step('account.onboarding_onboarding_step_setup_bill') new_wizard = self.env['account.tour.upload.bill'].create({}) view_id = self.env.ref('account.account_tour_upload_bill').id @@ -777,14 +777,3 @@ class account_journal(models.Model): def create_internal_transfer(self): """return action to create a internal transfer""" return self.open_payments_action('transfer', mode='form') - - ##################### - # Setup Steps Stuff # - ##################### - def mark_bank_setup_as_done_action(self): - """ Marks the 'bank setup' step as done in the setup bar and in the company.""" - self.company_id.sudo().set_onboarding_step_done('account_setup_bank_data_state') - - def unmark_bank_setup_as_done_action(self): - """ Marks the 'bank setup' step as not done in the setup bar and in the company.""" - self.company_id.account_setup_bank_data_state = 'not_done' diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 6ea588e4e20..c705106109c 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -26,14 +26,6 @@ MONTH_SELECTION = [ ('12', 'December'), ] -ONBOARDING_STEP_STATES = [ - ('not_done', "Not done"), - ('just_done', "Just done"), - ('done', "Done"), -] -DASHBOARD_ONBOARDING_STATES = ONBOARDING_STEP_STATES + [('closed', 'Closed')] - - class ResCompany(models.Model): _name = "res.company" _inherit = ["res.company", "mail.thread"] @@ -104,20 +96,6 @@ class ResCompany(models.Model): account_opening_journal_id = fields.Many2one(string='Opening Journal', comodel_name='account.journal', related='account_opening_move_id.journal_id', help="Journal where the opening entry of this company's accounting has been posted.", readonly=False) account_opening_date = fields.Date(string='Opening Entry', default=lambda self: fields.Date.context_today(self).replace(month=1, day=1), required=True, help="That is the date of the opening entry.") - # Fields marking the completion of a setup step - account_setup_bank_data_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding bank data step", default='not_done') - 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_setup_taxes_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding Taxes 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_create_invoice_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding create invoice step", compute='_compute_account_onboarding_create_invoice_state') - #this field must be there to ensure that the create_invoice_state stay complete and because we can't use a dependencies on account move - account_onboarding_create_invoice_state_flag = fields.Boolean(default=False, store=True) - account_onboarding_sale_tax_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding sale tax step", default='not_done') - - # account dashboard onboarding - account_invoice_onboarding_state = fields.Selection(DASHBOARD_ONBOARDING_STATES, string="State of the account invoice onboarding panel", default='not_done') - account_dashboard_onboarding_state = fields.Selection(DASHBOARD_ONBOARDING_STATES, string="State of the account dashboard onboarding panel", default='not_done') invoice_terms = fields.Html(string='Default Terms and Conditions', translate=True) terms_type = fields.Selection([('plain', 'Add a Note'), ('html', 'Add a link to a Web Page')], string='Terms & Conditions format', default='plain') @@ -125,8 +103,6 @@ class ResCompany(models.Model): sanitize_attributes=False, compute='_compute_invoice_terms_html', store=True, readonly=False) - account_setup_bill_state = fields.Selection(ONBOARDING_STEP_STATES, string="State of the onboarding bill step", default='not_done') - # Needed in the Point of Sale account_default_pos_receivable_account_id = fields.Many2one('account.account', string="Default PoS Receivable Account") @@ -232,17 +208,6 @@ class ResCompany(models.Model): foreign_vat_fpos = self.env['account.fiscal.position'].search([('company_id', '=', record.id), ('foreign_vat', '!=', False)]) record.account_enabled_tax_country_ids = foreign_vat_fpos.country_id + record.account_fiscal_country_id - @api.depends('account_onboarding_create_invoice_state_flag') - def _compute_account_onboarding_create_invoice_state(self): - for record in self: - if record.account_onboarding_create_invoice_state_flag: - record.account_onboarding_create_invoice_state = 'done' - elif self.env['account.move'].search([('company_id', '=', record.id), ('move_type', '=', 'out_invoice')], limit=1): - record.account_onboarding_create_invoice_state = 'just_done' - record.account_onboarding_create_invoice_state_flag = True - else: - record.account_onboarding_create_invoice_state = 'not_done' - @api.depends('terms_type') def _compute_invoice_terms_html(self): for company in self.filtered(lambda company: is_html_empty(company.invoice_terms_html) and company.terms_type == 'html'): @@ -252,40 +217,6 @@ class ResCompany(models.Model): if html: company.invoice_terms_html = html - def get_and_update_account_invoice_onboarding_state(self): - """ This method is called on the controller rendering method and ensures that the animations - are displayed only one time. """ - return self._get_and_update_onboarding_state( - 'account_invoice_onboarding_state', - self.get_account_invoice_onboarding_steps_states_names() - ) - - # YTI FIXME: Define only one method that returns {'account': [], 'sale': [], ...} - def get_account_invoice_onboarding_steps_states_names(self): - """ Necessary to add/edit steps from other modules (payment provider in this case). """ - return [ - 'base_onboarding_company_state', - 'account_onboarding_invoice_layout_state', - 'account_onboarding_create_invoice_state', - ] - - def get_and_update_account_dashboard_onboarding_state(self): - """ This method is called on the controller rendering method and ensures that the animations - are displayed only one time. """ - return self._get_and_update_onboarding_state( - 'account_dashboard_onboarding_state', - self.get_account_dashboard_onboarding_steps_states_names() - ) - - def get_account_dashboard_onboarding_steps_states_names(self): - """ Necessary to add/edit steps from other modules (account_winbooks_import in this case). """ - return [ - 'account_setup_bank_data_state', - 'account_setup_fy_data_state', - 'account_setup_coa_state', - 'account_setup_taxes_state', - ] - def get_new_account_code(self, current_code, old_prefix, new_prefix): digits = len(current_code) return new_prefix + current_code.replace(old_prefix, '', 1).lstrip('0').rjust(digits-len(new_prefix), '0') @@ -409,58 +340,17 @@ class ResCompany(models.Model): @api.model def setting_init_bank_account_action(self): - """ Called by the 'Bank Accounts' button of the setup bar.""" + """ Called by the 'Bank Accounts' button of the setup bar or from the Financial configuration menu.""" view_id = self.env.ref('account.setup_bank_account_wizard').id - return {'type': 'ir.actions.act_window', - 'name': _('Create a Bank Account'), - 'res_model': 'account.setup.bank.manual.config', - 'target': 'new', - 'view_mode': 'form', - 'views': [[view_id, 'form']], - } - - @api.model - def setting_init_fiscal_year_action(self): - """ Called by the 'Fiscal Year Opening' button of the setup bar.""" - company = self.env.company - new_wizard = self.env['account.financial.year.op'].create({'company_id': company.id}) - view_id = self.env.ref('account.setup_financial_year_opening_form').id - return { 'type': 'ir.actions.act_window', - 'name': _('Accounting Periods'), - 'view_mode': 'form', - 'res_model': 'account.financial.year.op', + 'name': _('Create a Bank Account'), + 'res_model': 'account.setup.bank.manual.config', 'target': 'new', - 'res_id': new_wizard.id, + 'view_mode': 'form', 'views': [[view_id, 'form']], } - @api.model - def setting_chart_of_accounts_action(self): - """ Called by the 'Chart of Accounts' button of the setup bar.""" - company = self.env.company - company.sudo().set_onboarding_step_done('account_setup_coa_state') - - # If an opening move has already been posted, we open the tree view showing all the accounts - if company.opening_move_posted(): - return 'account.action_account_form' - - # Then, we open will open a custom tree view allowing to edit opening balances of the account - view_id = self.env.ref('account.init_accounts_tree').id - # Hide the current year earnings account as it is automatically computed - domain = [('account_type', '!=', 'equity_unaffected'), ('company_id', '=', company.id)] - return { - 'type': 'ir.actions.act_window', - 'name': _('Chart of Accounts'), - 'res_model': 'account.account', - 'view_mode': 'tree', - 'limit': 99999999, - 'search_view_id': [self.env.ref('account.view_account_search').id], - 'views': [[view_id, 'list']], - 'domain': domain, - } - @api.model def create_op_move_if_non_existant(self): """ Creates an empty opening move in 'draft' state for the current company @@ -559,53 +449,9 @@ class ResCompany(models.Model): 'credit': debit_diff, }) - @api.model - def action_close_account_invoice_onboarding(self): - """ Mark the invoice onboarding panel as closed. """ - self.env.company.account_invoice_onboarding_state = 'closed' - - @api.model - def action_close_account_dashboard_onboarding(self): - """ Mark the dashboard onboarding panel as closed. """ - self.env.company.account_dashboard_onboarding_state = 'closed' - - @api.model - def action_open_account_onboarding_sale_tax(self): - """ Onboarding step for the invoice layout. """ - action = self.env["ir.actions.actions"]._for_xml_id("account.action_open_account_onboarding_sale_tax") - action['res_id'] = self.env.company.id - return action - - @api.model - def action_open_account_onboarding_create_invoice(self): - return self.env["ir.actions.actions"]._for_xml_id("account.action_open_account_onboarding_create_invoice") - - @api.model - def action_open_taxes_onboarding(self): - """ Called by the 'Taxes' button of the setup bar.""" - - company = self.env.company - company.sudo().set_onboarding_step_done('account_setup_taxes_state') - view_id_list = self.env.ref('account.view_onboarding_tax_tree').id - view_id_form = self.env.ref('account.view_tax_form').id - - return { - 'type': 'ir.actions.act_window', - 'name': _('Taxes'), - 'res_model': 'account.tax', - 'target': 'current', - 'views': [[view_id_list, 'list'], [view_id_form, 'form']], - 'context': {'search_default_sale': True, 'search_default_purchase': True, 'active_test': False}, - } - - def action_save_onboarding_invoice_layout(self): - """ Set the onboarding step as done """ - if bool(self.external_report_layout_id): - self.set_onboarding_step_done('account_onboarding_invoice_layout_state') - def action_save_onboarding_sale_tax(self): """ Set the onboarding step as done """ - self.set_onboarding_step_done('account_onboarding_sale_tax_state') + self.env['onboarding.onboarding.step'].action_validate_step('account.onboarding_onboarding_step_sales_tax') def get_chart_of_accounts_or_fail(self): account = self.env['account.account'].search([('company_id', '=', self.id)], limit=1) diff --git a/addons/account/models/onboarding_onboarding.py b/addons/account/models/onboarding_onboarding.py new file mode 100644 index 00000000000..9b51e26e572 --- /dev/null +++ b/addons/account/models/onboarding_onboarding.py @@ -0,0 +1,29 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, models + + +class Onboarding(models.Model): + _inherit = 'onboarding.onboarding' + + # Invoice Onboarding + @api.model + def action_close_panel_account_invoice(self): + self.action_close_panel('account.onboarding_onboarding_account_invoice') + + def _prepare_rendering_values(self): + """Compute existence of invoices for company.""" + self.ensure_one() + if self == self.env.ref('account.onboarding_onboarding_account_invoice', raise_if_not_found=False): + step = self.env.ref('account.onboarding_onboarding_step_create_invoice', raise_if_not_found=False) + if step and step.current_step_state == 'not_done': + if self.env['account.move'].search( + [('company_id', '=', self.env.company.id), ('move_type', '=', 'out_invoice')], limit=1 + ): + step.action_set_just_done() + return super()._prepare_rendering_values() + + # Dashboard Onboarding + @api.model + def action_close_panel_account_dashboard(self): + self.action_close_panel('account.onboarding_onboarding_account_dashboard') diff --git a/addons/account/models/onboarding_onboarding_step.py b/addons/account/models/onboarding_onboarding_step.py new file mode 100644 index 00000000000..df74c659eb0 --- /dev/null +++ b/addons/account/models/onboarding_onboarding_step.py @@ -0,0 +1,133 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import _, api, models + + +class OnboardingStep(models.Model): + _inherit = 'onboarding.onboarding.step' + + # COMMON STEPS + @api.model + def action_open_step_company_data(self): + """Set company's basic information.""" + action = { + 'type': 'ir.actions.act_window', + 'name': _('Set your company data'), + 'res_model': 'res.company', + 'res_id': self.env.company.id, + 'views': [(self.env.ref('account.res_company_form_view_onboarding').id, "form")], + 'target': 'new', + } + return action + + @api.model + def action_open_step_base_document_layout(self): + view_id = self.env.ref('web.view_base_document_layout').id + return { + 'name': _('Configure your document layout'), + 'type': 'ir.actions.act_window', + 'res_model': 'base.document.layout', + 'target': 'new', + 'views': [(view_id, 'form')], + } + + @api.model + def action_validate_step_base_document_layout(self): + """Set the onboarding(s) step as done only if layout is set.""" + step = self.env.ref('account.onboarding_onboarding_step_base_document_layout', raise_if_not_found=False) + if not step or not self.env.company.external_report_layout_id: + return False + return self.action_validate_step('account.onboarding_onboarding_step_base_document_layout') + + # INVOICE ONBOARDING + @api.model + def action_open_step_bank_account(self): + return self.env.company.setting_init_bank_account_action() + + @api.model + def action_open_step_create_invoice(self): + return { + 'type': 'ir.actions.act_window', + 'name': _('Create first invoice'), + 'views': [(self.env.ref("account.view_move_form").id, 'form')], + 'res_model': 'account.move', + 'context': {'default_move_type': 'out_invoice'}, + } + + # DASHBOARD ONBOARDING + @api.model + def action_open_step_fiscal_year(self): + company = self.env.company + company.create_op_move_if_non_existant() + new_wizard = self.env['account.financial.year.op'].create({'company_id': company.id}) + view_id = self.env.ref('account.setup_financial_year_opening_form').id + + return { + 'type': 'ir.actions.act_window', + 'name': _('Accounting Periods'), + 'view_mode': 'form', + 'res_model': 'account.financial.year.op', + 'target': 'new', + 'res_id': new_wizard.id, + 'views': [[view_id, 'form']], + } + + @api.model + def action_open_step_default_taxes(self): + """ Called by the 'Taxes' button of the setup bar.""" + self.action_validate_step('account.onboarding_onboarding_step_default_taxes') + + view_id_list = self.env.ref('account.view_onboarding_tax_tree').id + view_id_form = self.env.ref('account.view_tax_form').id + + return { + 'type': 'ir.actions.act_window', + 'name': _('Taxes'), + 'res_model': 'account.tax', + 'target': 'current', + 'views': [[view_id_list, 'list'], [view_id_form, 'form']], + 'context': {'search_default_sale': True, 'search_default_purchase': True, 'active_test': False}, + } + + @api.model + def action_open_step_chart_of_accounts(self): + """ Called by the 'Chart of Accounts' button of the dashboard onboarding panel.""" + company = self.env.company + self.sudo().action_validate_step('account.onboarding_onboarding_step_chart_of_accounts') + + # If an opening move has already been posted, we open the tree view showing all the accounts + if company.opening_move_posted(): + return 'account.action_account_form' + + # Otherwise, we create the opening move + company.create_op_move_if_non_existant() + + # Then, we open will open a custom tree view allowing to edit opening balances of the account + view_id = self.env.ref('account.init_accounts_tree').id + # Hide the current year earnings account as it is automatically computed + domain = [('account_type', '!=', 'equity_unaffected'), ('company_id', '=', company.id)] + return { + 'type': 'ir.actions.act_window', + 'name': _('Chart of Accounts'), + 'res_model': 'account.account', + 'view_mode': 'tree', + 'limit': 99999999, + 'search_view_id': [self.env.ref('account.view_account_search').id], + 'views': [[view_id, 'list']], + 'domain': domain, + } + + # STEPS WITHOUT PANEL + @api.model + def action_open_step_sales_tax(self): + view_id = self.env.ref('account.res_company_form_view_onboarding_sale_tax').id + + return { + 'type': 'ir.actions.act_window', + 'name': _('Sales tax'), + 'res_id': self.env.company.id, + 'res_model': 'res.company', + 'target': 'new', + 'view_mode': 'form', + 'views': [[view_id, 'form']], + } diff --git a/addons/account/static/src/js/tours/account.js b/addons/account/static/src/js/tours/account.js index 31b31678aa1..671a13b5e5d 100644 --- a/addons/account/static/src/js/tours/account.js +++ b/addons/account/static/src/js/tours/account.js @@ -14,29 +14,29 @@ registry.category("web_tour.tours").add('account_tour', { steps: [ ...stepUtils.goToAppSteps('account.menu_finance', _t('Send invoices to your customers in no time with the Invoicing app.')), { - trigger: "a.o_onboarding_step_action[data-method=action_open_base_onboarding_company]", + trigger: "a.o_onboarding_step_action[data-method=action_open_step_company_data]", content: _t("Start by checking your company's data."), position: "bottom", - skip_trigger: 'a[data-method=action_open_base_onboarding_company].o_onboarding_step_action__done', + skip_trigger: 'a[data-method=action_open_step_company_data].o_onboarding_step_action__done', }, { - trigger: "button[name=action_save_onboarding_company_step]", - extra_trigger: "a.o_onboarding_step_action[data-method=action_open_base_onboarding_company]", + trigger: "button.o_form_button_save", + extra_trigger: "a.o_onboarding_step_action[data-method=action_open_step_company_data]", content: _t("Looks good. Let's continue."), position: "bottom", - skip_trigger: 'a[data-method=action_open_base_onboarding_company].o_onboarding_step_action__done', + skip_trigger: 'a[data-method=action_open_step_company_data].o_onboarding_step_action__done', }, { - trigger: "a.o_onboarding_step_action[data-method=action_open_base_document_layout]", + trigger: "a.o_onboarding_step_action[data-method=action_open_step_base_document_layout]", content: _t("Customize your layout."), position: "bottom", - skip_trigger: 'a[data-method=action_open_base_document_layout].o_onboarding_step_action__done', + skip_trigger: 'a[data-method=action_open_step_base_document_layout].o_onboarding_step_action__done', }, { trigger: "button[name=document_layout_save]", - extra_trigger: "a.o_onboarding_step_action[data-method=action_open_base_document_layout]", + extra_trigger: "a.o_onboarding_step_action[data-method=action_open_step_base_document_layout]", content: _t("Once everything is as you want it, validate."), position: "top", - skip_trigger: 'a[data-method=action_open_base_document_layout].o_onboarding_step_action__done', + skip_trigger: 'a[data-method=action_open_step_base_document_layout].o_onboarding_step_action__done', }, { - trigger: "a.o_onboarding_step_action[data-method=action_open_account_onboarding_create_invoice]", + trigger: "a[data-method=action_open_step_create_invoice]", content: _t("Now, we'll create your first invoice."), position: "bottom", }, { diff --git a/addons/account/static/src/views/res_company_onboarding_form_controller.js b/addons/account/static/src/views/res_company_onboarding_form_controller.js new file mode 100644 index 00000000000..d6212a98e4a --- /dev/null +++ b/addons/account/static/src/views/res_company_onboarding_form_controller.js @@ -0,0 +1,12 @@ +/** @odoo-module **/ + +import OnboardingStepFormController from "@onboarding/views/form/onboarding_step_form_controller"; + +/** + * Validate the onboarding step on saving a record of another model (here `res.company`). + **/ +export default class CompanyOnboardingFormController extends OnboardingStepFormController { + get stepName() { + return "account.onboarding_onboarding_step_company_data"; + } +} diff --git a/addons/account/static/src/views/res_company_onboarding_form_view.js b/addons/account/static/src/views/res_company_onboarding_form_view.js new file mode 100644 index 00000000000..c40a897862d --- /dev/null +++ b/addons/account/static/src/views/res_company_onboarding_form_view.js @@ -0,0 +1,15 @@ +/** @odoo-module **/ + +import { formView } from "@web/views/form/form_view"; +import { registry } from "@web/core/registry"; + +import CompanyOnboardingFormController from "./res_company_onboarding_form_controller.js"; + + +const CompanyOnboardingFormView = { + ...formView, + Controller: CompanyOnboardingFormController, +}; + + +registry.category("views").add("company_onboarding_form", CompanyOnboardingFormView); diff --git a/addons/account/views/account_journal_dashboard_view.xml b/addons/account/views/account_journal_dashboard_view.xml index 924eba2b989..7bfc4e1810a 100644 --- a/addons/account/views/account_journal_dashboard_view.xml +++ b/addons/account/views/account_journal_dashboard_view.xml @@ -3,7 +3,7 @@ account.journal.dashboard.kanban account.journal - +