diff --git a/addons/account/models/company.py b/addons/account/models/company.py index e8376d6e350c9643577dda3b70cd19501b4fdc6f..0c1e652b775e98b611d8adbf0731fbc003a8d460 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -488,7 +488,7 @@ class ResCompany(models.Model): def action_save_onboarding_invoice_layout(self): """ Set the onboarding step as done """ - if bool(self.logo) and self.logo != self._get_logo(): + if bool(self.external_report_layout_id): self.set_onboarding_step_done('account_onboarding_invoice_layout_state') def action_save_onboarding_sale_tax(self): diff --git a/addons/account/wizard/base_document_layout.py b/addons/account/wizard/base_document_layout.py index 7ed9a4586f26d47ca4da02d84494b0de69c437d6..ab76e69aaa6ee2ac6b647e461f9691a7aeb60f8f 100644 --- a/addons/account/wizard/base_document_layout.py +++ b/addons/account/wizard/base_document_layout.py @@ -5,6 +5,7 @@ class BaseDocumentLayout(models.TransientModel): _inherit = 'base.document.layout' def document_layout_save(self): - super(BaseDocumentLayout, self).document_layout_save() + res = super(BaseDocumentLayout, self).document_layout_save() for wizard in self: wizard.company_id.action_save_onboarding_invoice_layout() + return res diff --git a/addons/hr_holidays/tests/test_holidays_flow.py b/addons/hr_holidays/tests/test_holidays_flow.py index f165aee200b8a2e6067d565a71a94dd6d6b47ff5..4f97fb5ac3f892035447d5b56101d9ef8c5eb47b 100644 --- a/addons/hr_holidays/tests/test_holidays_flow.py +++ b/addons/hr_holidays/tests/test_holidays_flow.py @@ -210,6 +210,7 @@ class TestHolidaysFlow(TestHrHolidaysBase): 'emp': [(6, 0, [self.ref('hr.employee_admin'), self.ref('hr.employee_qdp'), self.ref('hr.employee_al')])], 'holiday_type': 'Approved' } + self.env.company.external_report_layout_id = self.env.ref('web.external_layout_standard').id test_reports.try_report_action(self.env.cr, self.env.uid, 'action_hr_holidays_summary_employee', wiz_data=data_dict, context=ctx, our_module='hr_holidays') def test_sql_constraint_dates(self): diff --git a/addons/product/tests/test_product_pricelist.py b/addons/product/tests/test_product_pricelist.py index cb13db1b32746b1d4115935c9ee02c978cf56d98..acad92c3930bf406b832b32fb853ac8c1ed6bed6 100644 --- a/addons/product/tests/test_product_pricelist.py +++ b/addons/product/tests/test_product_pricelist.py @@ -3,6 +3,7 @@ from odoo.tests.common import TransactionCase from odoo.tools import float_compare, test_reports +from odoo.exceptions import UserError class TestProductPricelist(TransactionCase): @@ -124,4 +125,9 @@ class TestProductPricelist(TransactionCase): 'qty5': 30, 'price_list': self.customer_pricelist.id, } + + with self.assertRaises(UserError): + test_reports.try_report_action(self.cr, self.uid, 'action_product_price_list', wiz_data=data_dict, context=ctx, our_module='product') + + self.env.company.external_report_layout_id = self.env.ref('web.external_layout_standard').id test_reports.try_report_action(self.cr, self.uid, 'action_product_price_list', wiz_data=data_dict, context=ctx, our_module='product') diff --git a/addons/web/__manifest__.py b/addons/web/__manifest__.py index 0faf273b4fa9312629fe4c6296f5bd288637d219..2321ff7389c8fd3a09837c97e7aa4bda8f6b3486 100644 --- a/addons/web/__manifest__.py +++ b/addons/web/__manifest__.py @@ -18,7 +18,6 @@ This module provides the core of the Odoo Web Client. 'security/ir.model.access.csv', 'views/webclient_templates.xml', 'views/report_templates.xml', - 'data/res_company.xml', 'data/report_layout.xml', ], 'qweb': [ diff --git a/addons/web/data/res_company.xml b/addons/web/data/res_company.xml deleted file mode 100644 index 44db6af893120ec957184752f8c71c891a60f313..0000000000000000000000000000000000000000 --- a/addons/web/data/res_company.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<odoo> - <data noupdate="1"> - <record id="base.main_company" model="res.company"> - <field name="external_report_layout_id" ref="web.external_layout_standard"/> - </record> - </data> -</odoo> \ No newline at end of file diff --git a/odoo/addons/base/models/ir_actions_report.py b/odoo/addons/base/models/ir_actions_report.py index a3d354cfabc0e525708bcac610b72e34c1a5b9ce..4f0e96824fbfa9554ce3244d7f33bc5dd5cd3623 100644 --- a/odoo/addons/base/models/ir_actions_report.py +++ b/odoo/addons/base/models/ir_actions_report.py @@ -18,6 +18,7 @@ import lxml.html import tempfile import subprocess import re +import json from lxml import etree from contextlib import closing @@ -790,10 +791,6 @@ class IrActionsReport(models.Model): :param docids: id/ids/browserecord of the records to print (if not used, pass an empty list) :param report_name: Name of the template to generate an action for """ - discard_logo_check = self.env.context.get('discard_logo_check') - if self.env.is_admin() and ((not self.env.company.external_report_layout_id) or (not discard_logo_check and not self.env.company.logo)) and config: - return self.env.ref('base.action_base_document_layout_configurator').read()[0] - context = self.env.context if docids: if isinstance(docids, models.Model): @@ -804,7 +801,7 @@ class IrActionsReport(models.Model): active_ids = docids context = dict(self.env.context, active_ids=active_ids) - return { + report_action = { 'context': context, 'data': data, 'type': 'ir.actions.report', @@ -813,3 +810,15 @@ class IrActionsReport(models.Model): 'report_file': self.report_file, 'name': self.name, } + + discard_logo_check = self.env.context.get('discard_logo_check') + if self.env.is_admin() and not self.env.company.external_report_layout_id and config and not discard_logo_check: + action = self.env.ref('base.action_base_document_layout_configurator').read()[0] + ctx = action.get('context') + py_ctx = json.loads(ctx) if ctx else {} + report_action['close_on_report_download'] = True + py_ctx['report_action'] = report_action + action['context'] = py_ctx + return action + + return report_action diff --git a/odoo/addons/base/wizard/base_document_layout.py b/odoo/addons/base/wizard/base_document_layout.py index afbe91f3c8e98587d8eb45ffe8cbb3bcea23918e..e41ed375d90db8d214b2c30f8a520e19d01ef421 100644 --- a/odoo/addons/base/wizard/base_document_layout.py +++ b/odoo/addons/base/wizard/base_document_layout.py @@ -186,4 +186,4 @@ class BaseDocumentLayout(models.TransientModel): def document_layout_save(self): # meant to be overridden - pass + return self.env.context.get('report_action') or {'type': 'ir.actions.act_window_close'}