From 7b368e721519306fb5b48b3edbd4d48b7c63ee39 Mon Sep 17 00:00:00 2001 From: "Pierre Collinet (pic)" Date: Tue, 30 Jun 2020 13:39:23 +0000 Subject: [PATCH] [FIX] sale: Apply several fix on sales tour 1. Lead to loose the tour: Remove the step of the tour that asks to set an address (the address is auto-completed at free trial based on domain name). 2. Bug: At step 3, it redirects to the invoice settings to select a localization, when you click on "install more packages", you are sent back to the sales app. --> this bug is related to res_config_settings.js from base addon. I tried to fix this bug by adding a data-attribute "discard" in the res_config_settings_views and checking this additional condition in the js. 3. Bug: Tour blocks at last step "send by email" on quotation. After clicking on "sent" on the pop-up, there should be rainbow effect to mark the end of the tour. 4. Bug: Sale order line: fix the blue color on Invoiced Quantity only, instead of the full line 5. Put the "sample product" in active= false (it's necessary for the sample invoice but should not be visible to the user, they should create their own) 6. Merge the 2 dates fields related to expected delivery on sale.order --> since other modules extends this module, I made the field expected_date invisible and put the same value in both fields. This value is the max of the order_lines.expected_date closes odoo/odoo#59261 Taskid: 2277314 X-original-commit: 0f81816d4ddb0febd28f6c6bb5dd50ae570333e1 Signed-off-by: Yannick Tivisse (yti) --- addons/account/views/res_config_settings_views.xml | 2 +- addons/sale/models/res_company.py | 10 ++++++++-- addons/sale/models/sale.py | 4 ++++ addons/sale/static/src/js/tours/sale.js | 7 +------ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/addons/account/views/res_config_settings_views.xml b/addons/account/views/res_config_settings_views.xml index c793dfa1a8c..b573b0cdfab 100644 --- a/addons/account/views/res_config_settings_views.xml +++ b/addons/account/views/res_config_settings_views.xml @@ -39,7 +39,7 @@
-
diff --git a/addons/sale/models/res_company.py b/addons/sale/models/res_company.py index f75a010cb3d..e5f70e2eb98 100644 --- a/addons/sale/models/res_company.py +++ b/addons/sale/models/res_company.py @@ -1,8 +1,10 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +import base64 from odoo import api, fields, models, _ - +from odoo.modules.module import get_module_resource +from odoo.modules.module import get_resource_path class ResCompany(models.Model): _inherit = "res.company" @@ -52,9 +54,13 @@ class ResCompany(models.Model): # take any existing product or create one product = self.env['product.product'].search([], limit=1) if len(product) == 0: + default_image_path = get_module_resource('product', 'static/img', 'product_product_13-image.png') product = self.env['product.product'].create({ - 'name': _('Sample Product') + 'name': _('Sample Product'), + 'active': False, + 'image_1920': base64.b64encode(open(default_image_path, 'rb').read()) }) + product.product_tmpl_id.write({'active': False}) self.env['sale.order.line'].create({ 'name': _('Sample Order Line'), 'product_id': product.id, diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 3e90debc941..73708e13e51 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -309,6 +309,10 @@ class SaleOrder(models.Model): else: order.expected_date = False + @api.onchange('expected_date') + def _onchange_commitment_date(self): + self.commitment_date = self.expected_date + @api.depends('transaction_ids') def _compute_authorized_transaction_ids(self): for trans in self: diff --git a/addons/sale/static/src/js/tours/sale.js b/addons/sale/static/src/js/tours/sale.js index f2208799a1e..73f87ad740b 100644 --- a/addons/sale/static/src/js/tours/sale.js +++ b/addons/sale/static/src/js/tours/sale.js @@ -24,11 +24,6 @@ tour.register("sale_tour", { extra_trigger: ".o_sale_order", content: _t("Start by checking your company's data."), position: "bottom", -}, { - trigger: ".modal-content input.o_field_widget[name='street'], .modal-content input.o_field_widget[name='street_name']", - content: _t("Let's enter the address."), - position: "right", - run: "text Rainbow street" }, { trigger: ".modal-content button[name='action_save_onboarding_company_step']", content: _t("Looks good. Let's continue."), @@ -117,7 +112,7 @@ tour.register("sale_quote_tour", { }, ...tour.stepUtils.statusbarButtonsSteps("Send by Email", _t("Send the quote to yourself and check what the customer will receive."), ".o_statusbar_buttons button[name='action_quotation_send']"), { - trigger: ".modal-content input[name='email']", + trigger: ".modal-content div[name='partner_ids']", content: _t("Write your own email address here in order to test the flow."), run: "text agrolait@example.com" },