From 89e358caa8627c5eff21ee63015dece0997db2b4 Mon Sep 17 00:00:00 2001 From: eco-odoo Date: Fri, 20 Jul 2018 14:09:27 +0200 Subject: [PATCH] [FIX] onboarding: Fix/Update onboarding to v2.0 Specification ============= - Fix lots of bug due to the BS4 migration - Improve steps - Validate some steps (Like the company configuration) in all the onboarding bars if done in one onboarding bar. - Only animate the confetti one time if a step is done, instead of on each view loading For more information, see: https://www.odoo.com/web#id=1869513&action=333&active_id=965&model=project.task&view_type=form&menu_id=4720 --- addons/account/__manifest__.py | 1 - addons/account/controllers/onboarding.py | 14 +- addons/account/models/account_invoice.py | 2 +- .../models/account_journal_dashboard.py | 18 +- addons/account/models/company.py | 154 ++++++------ addons/account/models/res_config_settings.py | 1 - .../src/js/account_dashboard_setup_bar.js | 235 ------------------ .../src/xml/account_dashboard_setup_bar.xml | 37 --- .../account_dashboard_setup_bar_tests.js | 65 ----- addons/account/views/account.xml | 1 - .../views/account_onboarding_templates.xml | 110 ++++++-- .../views/res_config_settings_views.xml | 12 - addons/account/wizard/setup_wizards.py | 8 +- addons/account/wizard/setup_wizards_view.xml | 26 +- .../base_setup/models/res_config_settings.py | 2 +- addons/base_vat/views/res_company_views.xml | 3 - addons/payment/models/res_company.py | 23 +- .../payment_acquirer_onboarding_templates.xml | 153 +++++------- .../payment_acquirer_onboarding_wizard.py | 93 +++---- addons/sale/controllers/onboarding.py | 10 +- addons/sale/models/res_company.py | 127 ++++++---- addons/sale/models/sale.py | 1 + .../onboarding_quotation_order_tooltip.jpg | Bin 0 -> 12084 bytes .../sale/static/src/scss/sale_onboarding.scss | 11 + addons/sale/views/assets.xml | 6 +- addons/sale/views/sale_onboarding_views.xml | 160 +++++++----- addons/sale/views/sale_views.xml | 2 +- .../payment_acquirer_onboarding_wizard.py | 30 ++- .../src/js/views/abstract_controller.js | 39 +-- addons/web/static/src/scss/banner.scss | 3 + addons/web/static/src/scss/form_view.scss | 14 +- addons/web/views/webclient_templates.xml | 1 + addons/website_sale/models/res_company.py | 4 +- .../website_sale/views/onboarding_views.xml | 17 +- .../payment_acquirer_onboarding_wizard.py | 2 +- .../website_theme_install/models/__init__.py | 1 - .../models/res_company.py | 28 --- addons/website_theme_install/views/views.xml | 11 - .../base/data/report_paperformat_data.xml | 2 +- odoo/addons/base/models/ir_actions_report.py | 2 +- odoo/addons/base/models/res_company.py | 42 +++- .../base/static/src/scss/onboarding.scss | 171 +++++-------- odoo/addons/base/views/onboarding_views.xml | 120 +++++---- odoo/addons/base/views/res_company_views.xml | 65 +++-- 44 files changed, 742 insertions(+), 1085 deletions(-) delete mode 100644 addons/account/static/src/xml/account_dashboard_setup_bar.xml create mode 100644 addons/sale/static/src/img/onboarding_quotation_order_tooltip.jpg create mode 100644 addons/sale/static/src/scss/sale_onboarding.scss delete mode 100644 addons/website_theme_install/models/res_company.py diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py index 13d366f8200..1f0aa99d6a4 100644 --- a/addons/account/__manifest__.py +++ b/addons/account/__manifest__.py @@ -86,7 +86,6 @@ You could use this simplified accounting in case you work with an (external) acc "static/src/xml/account_reconciliation.xml", "static/src/xml/account_payment.xml", "static/src/xml/account_report_backend.xml", - "static/src/xml/account_dashboard_setup_bar.xml", ], 'installable': True, 'application': True, diff --git a/addons/account/controllers/onboarding.py b/addons/account/controllers/onboarding.py index 1fd91294489..879fd0a82fc 100644 --- a/addons/account/controllers/onboarding.py +++ b/addons/account/controllers/onboarding.py @@ -10,13 +10,15 @@ class OnboardingController(http.Controller): It can be empty if the user has closed it or if he doesn't have the permission to see it. """ + company = request.env.user.company_id if not request.env.user._is_admin() or \ - request.env.user.company_id.account_invoice_onboarding_closed: + company.account_invoice_onboarding_state == 'closed': return {} return { 'html': request.env.ref('account.account_invoice_onboarding_panel').render({ - 'company': request.env.user.company_id, + 'company': company, + 'state': company.get_and_update_account_invoice_onboarding_state() }) } @@ -25,13 +27,15 @@ class OnboardingController(http.Controller): """ 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. """ + company = request.env.user.company_id if not request.env.user._is_admin() or \ - request.env.user.company_id.account_dashboard_onboarding_closed: + company.account_dashboard_onboarding_state == 'closed': return {} return { 'html': request.env.ref('account.account_dashboard_onboarding_panel').render({ - 'company': request.env.user.company_id, + 'company': company, + 'state': company.get_and_update_account_dashboard_onboarding_state() }) - } \ No newline at end of file + } diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 0ba6359b6af..58711dfb92f 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -607,7 +607,7 @@ class AccountInvoice(models.Model): def message_post(self, **kwargs): if self.env.context.get('mark_invoice_as_sent'): self.filtered(lambda inv: not inv.sent).write({'sent': True}) - self.env.user.company_id.account_onboarding_sample_invoice_sent = True + self.env.user.company_id.set_onboarding_step_done('account_onboarding_sample_invoice_state') return super(AccountInvoice, self.with_context(mail_post_autofollow=True)).message_post(**kwargs) @api.model diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index a8e229883d1..da0c1dbb960 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -26,7 +26,6 @@ class account_journal(models.Model): kanban_dashboard_graph = fields.Text(compute='_kanban_dashboard_graph') show_on_dashboard = fields.Boolean(string='Show journal on dashboard', help="Whether this journal should be displayed on the dashboard or not", default=True) color = fields.Integer("Color Index", default=0) - account_setup_bank_data_done = fields.Boolean(string='Bank setup marked as done', related='company_id.account_setup_bank_data_done', help="Technical field used in the special view for the setup bar step.") def _graph_title_and_key(self): if self.type in ['sale', 'purchase']: @@ -434,23 +433,10 @@ class account_journal(models.Model): ##################### # Setup Steps Stuff # ##################### - @api.model - def retrieve_account_dashboard_setup_bar(self): - """ Returns the data used by the setup bar on the Accounting app dashboard.""" - company = self.env.user.company_id - return { - 'show_setup_bar': not company.account_setup_bar_closed, - 'company': company.account_setup_company_data_done, - 'bank': company.account_setup_bank_data_done, - 'fiscal_year': company.account_setup_fy_data_done, - 'chart_of_accounts': company.account_setup_coa_done, - 'initial_balance': company.opening_move_posted(), - } - 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.account_setup_bank_data_done = True + self.company_id.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_done = False + 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 7e4ab7c216f..b659d0ad00e 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -71,33 +71,45 @@ Best Regards,''')) 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.") account_opening_date = fields.Date(string='Opening Date', related='account_opening_move_id.date', help="Date at which the opening entry of this company's accounting has been posted.") - #Fields marking the completion of a setup step - account_setup_company_data_done = fields.Boolean(string='Company Setup Marked As Done', help="Technical field holding the status of the company setup step.") - account_setup_bank_data_done = fields.Boolean('Bank Setup Marked As Done', help="Technical field holding the status of the bank setup step.") - account_setup_fy_data_done = fields.Boolean('Financial Year Setup Marked As Done', help="Technical field holding the status of the financial year setup step.") - account_setup_coa_done = fields.Boolean(string='Chart of Account Checked', help="Technical field holding the status of the chart of account setup step.") - account_setup_bar_closed = fields.Boolean(string='Setup Bar Closed', help="Technical field set to True when setup bar has been closed by the user.") - - # account invoice onboarding - account_invoice_onboarding_closed = fields.Boolean( - string="Account invoice onboarding panel closed", - help="Refers to the account invoice onboarding panel closed state.") - account_invoice_onboarding_folded = fields.Boolean( - string="Account invoice onboarding panel folded", - help="Refers to the account invoice onboarding panel folded state.") - - account_onboarding_invoice_layout_done = fields.Boolean("Onboarding invoice layout step done", - compute="_compute_account_onboarding_invoice_layout_done") - account_onboarding_sample_invoice_sent = fields.Boolean( - "Onboarding sample invoice step completed", default=False) + # Fields marking the completion of a setup step + # YTI FIXME : The selection should be factorize as a static list in base, like ONBOARDING_STEP_STATES + account_setup_bank_data_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done")], string="State of the onboarding bank data step", default='not_done') + account_setup_fy_data_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done")], string="State of the onboarding fiscal year step", default='not_done') + account_setup_coa_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done")], string="State of the onboarding charts of account step", default='not_done') + account_onboarding_invoice_layout_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done")], string="State of the onboarding invoice layout step", default='not_done') + account_onboarding_sample_invoice_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done")], string="State of the onboarding sample invoice step", default='not_done') + account_onboarding_sale_tax_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done")], string="State of the onboarding sale tax step", default='not_done') # account dashboard onboarding - account_dashboard_onboarding_closed = fields.Boolean( - string="Account dashboard onboarding panel closed", - help="Refers to the account dashboard onboarding panel closed state.") - account_dashboard_onboarding_folded = fields.Boolean( - string="Account dashboard onboarding panel folded", - help="Refers to the account dashboard onboarding panel folded state.") + account_invoice_onboarding_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done"), ('closed', "Closed")], string="State of the account invoice onboarding panel", default='not_done') + account_dashboard_onboarding_state = fields.Selection([('not_done', "Not done"), ('just_done', "Just done"), ('done', "Done"), ('closed', "Closed")], string="State of the account dashboard onboarding panel", default='not_done') + + 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_onbarding_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 acquirer in this case). """ + return [ + 'base_onboarding_company_state', + 'account_onboarding_invoice_layout_state', + 'account_onboarding_sample_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_onbarding_state('account_dashboard_onboarding_state', [ + 'base_onboarding_company_state', + 'account_setup_bank_data_state', + 'account_setup_fy_data_state', + 'account_setup_coa_state', + ]) @api.multi def _check_lock_dates(self, vals): @@ -260,20 +272,6 @@ Best Regards,''')) return super(ResCompany, self).write(values) - @api.model - def setting_init_company_action(self): - """ Called by the 'Company Data' button of the setup bar.""" - company = self.env.user.company_id - view_id = self.env.ref('account.setup_view_company_form').id - return {'type': 'ir.actions.act_window', - 'name': _('Company Data'), - 'res_model': 'res.company', - 'target': 'new', - 'view_mode': 'form', - 'res_id': company.id, - 'views': [[view_id, 'form']], - } - @api.model def setting_init_bank_account_action(self): """ Called by the 'Bank Accounts' button of the setup bar.""" @@ -308,7 +306,7 @@ Best Regards,''')) def setting_chart_of_accounts_action(self): """ Called by the 'Chart of Accounts' button of the setup bar.""" company = self.env.user.company_id - company.account_setup_coa_done = True + company.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(): @@ -332,11 +330,6 @@ Best Regards,''')) 'domain': domain, } - @api.model - def setting_hide_setup_bar(self): - """ Called by the cross button of the setup bar, to close it.""" - self.env.user.company_id.account_setup_bar_closed = True - @api.model def create_op_move_if_non_existant(self): """ Creates an empty opening move in 'draft' state for the current company @@ -356,14 +349,6 @@ Best Regards,''')) 'journal_id': default_journal.id, }) - def mark_company_setup_as_done_action(self): - """ Marks the 'company' setup step as completed.""" - self.account_setup_company_data_done = True - - def unmark_company_setup_as_done_action(self): - """ Marks the 'company' setup step as uncompleted.""" - self.account_setup_company_data_done = False - def opening_move_posted(self): """ Returns true if this company has an opening account move and this move is posted.""" return bool(self.account_opening_move_id) and self.account_opening_move_id.state == 'posted' @@ -430,36 +415,15 @@ Best Regards,''')) 'credit': debit_diff, }) - @api.depends('logo', 'account_invoice_onboarding_closed') - def _compute_account_onboarding_invoice_layout_done(self): - """ The invoice onboarding step is marked as done if logo is filled - and different from the default one. """ - for record in self: - record.account_onboarding_invoice_layout_done = \ - record.account_invoice_onboarding_closed or ( - bool(record.logo) and record.logo != record._get_logo()) - - @api.model - def action_toggle_fold_account_invoice_onboarding(self): - """ Toggle the onboarding panel `folded` state. """ - self.env.user.company_id.account_invoice_onboarding_folded =\ - not self.env.user.company_id.account_invoice_onboarding_folded - @api.model def action_close_account_invoice_onboarding(self): - """ Mark the onboarding panel as closed. """ - self.env.user.company_id.account_invoice_onboarding_closed = True - - @api.model - def action_toggle_fold_account_dashboard_onboarding(self): - """ Toggle the dashboard onboarding panel `folded` state. """ - self.env.user.company_id.account_dashboard_onboarding_folded =\ - not self.env.user.company_id.account_dashboard_onboarding_folded + """ Mark the invoice onboarding panel as closed. """ + self.env.user.company_id.account_invoice_onboarding_state = 'closed' @api.model def action_close_account_dashboard_onboarding(self): """ Mark the dashboard onboarding panel as closed. """ - self.env.user.company_id.account_dashboard_onboarding_closed = True + self.env.user.company_id.account_dashboard_onboarding_state = 'closed' @api.model def action_open_account_onboarding_invoice_layout(self): @@ -468,6 +432,13 @@ Best Regards,''')) action['res_id'] = self.env.user.company_id.id return action + @api.model + def action_open_account_onboarding_sale_tax(self): + """ Onboarding step for the invoice layout. """ + action = self.env.ref('account.action_open_account_onboarding_sale_tax').read()[0] + action['res_id'] = self.env.user.company_id.id + return action + @api.model def _get_sample_invoice(self): """ Get a sample invoice or create one if it does not exist. """ @@ -482,13 +453,7 @@ Best Regards,''')) if len(sample_invoice) == 0: # If there are no existing accounts or no journal, fail - account = self.env['account.account'].search([('company_id', '=', company_id)], limit=1) - if len(account) == 0: - action = self.env.ref('account.action_account_config') - msg = _( - "We cannot find a chart of accounts for this company, you should configure it. \n" - "Please go to Account Configuration and select or install a fiscal localization.") - raise RedirectWarning(msg, action.id, _("Go to the configuration panel")) + account = self.env.user.company_id.get_chart_of_accounts_or_fail() journal = self.env['account.journal'].search([('company_id', '=', company_id)], limit=1) if len(journal) == 0: @@ -537,3 +502,24 @@ Best Regards,''')) 'force_email': True, } return action + + @api.multi + def action_save_onboarding_invoice_layout(self): + """ Set the onboarding step as done """ + if bool(self.logo) and self.logo != self._get_logo(): + self.set_onboarding_step_done('account_onboarding_invoice_layout_state') + + @api.multi + def action_save_onboarding_sale_tax(self): + """ Set the onboarding step as done """ + self.set_onboarding_step_done('account_onboarding_sale_tax_state') + + def get_chart_of_accounts_or_fail(self): + account = self.env['account.account'].search([('company_id', '=', self.id)], limit=1) + if len(account) == 0: + action = self.env.ref('account.action_account_config') + msg = _( + "We cannot find a chart of accounts for this company, you should configure it. \n" + "Please go to Account Configuration and select or install a fiscal localization.") + raise RedirectWarning(msg, action.id, _("Go to the configuration panel")) + return account diff --git a/addons/account/models/res_config_settings.py b/addons/account/models/res_config_settings.py index 481e9af3218..d9e08ca9bbf 100644 --- a/addons/account/models/res_config_settings.py +++ b/addons/account/models/res_config_settings.py @@ -74,7 +74,6 @@ class ResConfigSettings(models.TransientModel): module_account_taxcloud = fields.Boolean(string="Account TaxCloud") tax_exigibility = fields.Boolean(string='Cash Basis', related='company_id.tax_exigibility') tax_cash_basis_journal_id = fields.Many2one('account.journal', related='company_id.tax_cash_basis_journal_id', string="Tax Cash Basis Journal") - account_hide_setup_bar = fields.Boolean(string='Hide Setup Bar', related='company_id.account_setup_bar_closed',help="Tick if you wish to hide the setup bar on the dashboard") invoice_reference_type = fields.Selection(string='Communication', related='company_id.invoice_reference_type', help='Default Reference Type on Invoices.') account_bank_reconciliation_start = fields.Date(string="Bank Reconciliation Threshold", diff --git a/addons/account/static/src/js/account_dashboard_setup_bar.js b/addons/account/static/src/js/account_dashboard_setup_bar.js index 17aa1bad174..e69de29bb2d 100644 --- a/addons/account/static/src/js/account_dashboard_setup_bar.js +++ b/addons/account/static/src/js/account_dashboard_setup_bar.js @@ -1,235 +0,0 @@ -odoo.define('account.dashboard_setup_bar', function (require) { -"use strict"; - -var core = require('web.core'); -var field_utils = require('web.field_utils'); -var KanbanView = require('web.KanbanView'); -var KanbanModel = require('web.KanbanModel'); -var KanbanRenderer = require('web.KanbanRenderer'); -var KanbanController = require('web.KanbanController'); -var session = require('web.session'); -var view_registry = require('web.view_registry'); - -var QWeb = core.qweb; -var _t = core._t; -var _lt = core._lt; - -var COMPANY_METHOD_TYPE = "company_object"; - -var AccountSetupBarRenderer = KanbanRenderer.extend({ - events: _.extend({}, KanbanRenderer.prototype.events, { - 'click .account_setup_dashboard_action': 'onActionClicked', - }), - - //-------------------------------------------------------------------------- - // Private - //-------------------------------------------------------------------------- - - /** - * Notifies the controller that the target has changed. - * - * @private - * @param {string} target_name the name of the changed target - * @param {string} value the new value - */ - _notifyTargetChange: function (target_name, value) { - this.trigger_up('dashboard_edit_target', { - target_name: target_name, - target_value: value, - }); - }, - /** - * @override - * @private - * @returns {Deferred} - */ - _render: function () { - var self = this; - - return this._super.apply(this, arguments).then(function () { - var values = self.state.dashboardValues; - var account_dashboard = QWeb.render('account.AccountDashboardSetupBar', { - widget: self, - values: values, - }); - self.$el.prepend(account_dashboard); - }); - }, - - //-------------------------------------------------------------------------- - // Handlers - //-------------------------------------------------------------------------- - - /** - * @private - * @param {MouseEvent} - */ - onActionClicked: function(e) { - e.preventDefault(); - var self = this; - var $action = $(e.currentTarget); - var name_attr = $action.attr('name'); - var type_attr = $action.attr('type'); - var action_context = $action.data('context'); - - if(type_attr == COMPANY_METHOD_TYPE) { - self.trigger_up('company_button_action', {rpc_method: name_attr, context: action_context}) - } - }, -}); - -var AccountSetupBarModel = KanbanModel.extend({ - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - /** - * @override - */ - init: function () { - this.dashboardValues = {}; - this._super.apply(this, arguments); - }, - - /** - * @override - */ - get: function (localID) { - var result = this._super.apply(this, arguments); - if (this.dashboardValues[localID]) { - result.dashboardValues = this.dashboardValues[localID]; - } - return result; - }, - - - /** - * @œverride - * @returns {Deferred} - */ - load: function () { - return this._loadDashboard(this._super.apply(this, arguments)); - }, - /** - * @œverride - * @returns {Deferred} - */ - reload: function () { - return this._loadDashboard(this._super.apply(this, arguments)); - }, - - //-------------------------------------------------------------------------- - // Private - //-------------------------------------------------------------------------- - - /** - * @abstract - * @returns {Deferred} resolves to the required dashboard data - */ - _fetchDashboardData: function () { - return $.when(this._rpc({ - model: 'account.journal', - method: 'retrieve_account_dashboard_setup_bar', - args: [], - })); - }, - /** - * @private - * @param {Deferred} super_def a deferred that resolves with a dataPoint id - * @returns {Deferred} resolves to the dataPoint id - */ - _loadDashboard: function (super_def) { - var self = this; - var dashboard_def = this._fetchDashboardData(); - return $.when(super_def, dashboard_def).then(function (id, dashboardValues) { - self.dashboardValues[id] = dashboardValues; - return id; - }); - }, -}); - -var AccountSetupBarController = KanbanController.extend({ - /* The company_button_action action allows the buttons of the setup bar to - * trigger Python code defined in api.model functions in res.company model, - * and to execute the action returned them. - * It uses the 'type' attributes on buttons : if 'company_object', it will - * run Python function 'name' of company model. - */ - custom_events: _.extend({}, KanbanController.prototype.custom_events, { - dashboard_open_action: '_onDashboardOpenAction', - company_button_action: '_triggerCompanyButtonAction', - }), - - start: function () { - this._super(); - var self = this; - core.bus.on('refresh_account_dashboard', this, function (){ - self.trigger_up('reload') - }); - }, - - //-------------------------------------------------------------------------- - // Handlers - //-------------------------------------------------------------------------- - - /** - * @private - * @param {OdooEvent} e - */ - _onDashboardOpenAction: function (e) { - var action_name = e.data.action_name; - var action_context = e.data.action_context; - return this.do_action(action_name, { - additional_context: action_context, - }); - }, - - /** - * Manages the clicks on the setup bar buttons. - **/ - _triggerCompanyButtonAction: function (odooEvent) { - var self = this - if (odooEvent.data.rpc_method !== undefined) { - self._rpc({ - model: 'res.company', - method: odooEvent.data.rpc_method, - args: [], - }) - .then( - function(rslt_action) { - if (rslt_action !== undefined) { - self.do_action(rslt_action, { - action_context: odooEvent.data.context, - on_close: function () { - self.trigger_up('reload'); //Reloads the dashboard to refresh the status of the setup bar. - }, - }); - } - else { //Happens for any button not returning anything, like the cross to close the setup bar, for example. - self.trigger_up('reload'); - } - }); - } - } -}); - -var AccountDashboardView = KanbanView.extend({ - config: _.extend({}, KanbanView.prototype.config, { - Model: AccountSetupBarModel, - Renderer: AccountSetupBarRenderer, - Controller: AccountSetupBarController, - }), - display_name: _lt('Dashboard'), - icon: 'fa-dashboard', - searchview_hidden: false, -}); - -view_registry.add('account_setup_bar', AccountDashboardView); - -return { - Model: AccountSetupBarModel, - Renderer: AccountSetupBarRenderer, - Controller: AccountSetupBarController, -}; - -}); diff --git a/addons/account/static/src/xml/account_dashboard_setup_bar.xml b/addons/account/static/src/xml/account_dashboard_setup_bar.xml deleted file mode 100644 index a3e8600b894..00000000000 --- a/addons/account/static/src/xml/account_dashboard_setup_bar.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - diff --git a/addons/account/static/tests/account_dashboard_setup_bar_tests.js b/addons/account/static/tests/account_dashboard_setup_bar_tests.js index 4729467a13d..e69de29bb2d 100644 --- a/addons/account/static/tests/account_dashboard_setup_bar_tests.js +++ b/addons/account/static/tests/account_dashboard_setup_bar_tests.js @@ -1,65 +0,0 @@ -odoo.define('account.setup_bar_tests', function (require) { -"use strict"; - -var testUtils = require('web.test_utils'); -var view_registry = require('web.view_registry'); - -var createView = testUtils.createView; - -QUnit.module('Views', {}, function () { - -QUnit.module('Account Dashboard Setup Bar', { - beforeEach: function() { - this.data = { - partner: { - fields: { - foo: {string: "Foo", type: "char"}, - }, - records: [ - {id: 1, foo: "yop"}, - {id: 2, foo: "blip"}, - {id: 3, foo: "gnap"}, - {id: 4, foo: "blip"}, - ] - }, - }; - this.dashboard_data = { - show_setup_bar: true, - company: false, - bank: false, - fiscal_year: false, - chart_of_accounts: false, - initial_balance: false, - }; - } -}); - -QUnit.test('setup bar basic rendering', function(assert) { - assert.expect(2); - - var dashboard_data = this.dashboard_data; - var kanban = createView({ - View: view_registry.get('account_setup_bar'), - model: 'partner', - data: this.data, - arch: '' + - '' + - '
' + - '
' + - '
', - mockRPC: function(route, args) { - if (args.method === 'retrieve_account_dashboard_setup_bar') { - assert.ok(true, "should call /retrieve_account_dashboard_setup_bar"); - return $.when(dashboard_data); - } - return this._super(route, args); - }, - }); - - assert.strictEqual(kanban.$('.o_account_dashboard_header').length, 1, "should render the setup bar"); - kanban.destroy(); -}); - -}); - -}); diff --git a/addons/account/views/account.xml b/addons/account/views/account.xml index 70d525890d1..348e6fdeec2 100644 --- a/addons/account/views/account.xml +++ b/addons/account/views/account.xml @@ -22,7 +22,6 @@ - diff --git a/addons/account/views/account_onboarding_templates.xml b/addons/account/views/account_onboarding_templates.xml index 682da061ae0..47150b860ce 100644 --- a/addons/account/views/account_onboarding_templates.xml +++ b/addons/account/views/account_onboarding_templates.xml @@ -4,49 +4,69 @@ + + + + account.invoice.layout.onboarding.form + res.company + + primary + 1000 + + +