diff --git a/addons/website_sale/__init__.py b/addons/website_sale/__init__.py index 1d8f8471a07..8b3520af782 100644 --- a/addons/website_sale/__init__.py +++ b/addons/website_sale/__init__.py @@ -1,11 +1,21 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import api, SUPERUSER_ID +from odoo import api, SUPERUSER_ID, _ from . import controllers from . import models from . import wizard from . import report +def pre_init_hook(cr): + env = api.Environment(cr, SUPERUSER_ID, {}) + terms_conditions = env['ir.config_parameter'].get_param('account.use_invoice_terms') + if not terms_conditions: + env['ir.config_parameter'].set_param('account.use_invoice_terms', True) + companies = env['res.company'].search([]) + for company in companies: + company.terms_type = 'html' + company.invoice_terms = _('Terms & Conditions: %s/terms', company.get_base_url()) + def uninstall_hook(cr, registry): ''' Need to reenable the `product` pricelist multi-company rule that were diff --git a/addons/website_sale/__manifest__.py b/addons/website_sale/__manifest__.py index c67d4036e7b..d4cdee530ed 100644 --- a/addons/website_sale/__manifest__.py +++ b/addons/website_sale/__manifest__.py @@ -33,5 +33,6 @@ 'qweb': ['static/src/xml/*.xml'], 'installable': True, 'application': True, + 'pre_init_hook': 'pre_init_hook', 'uninstall_hook': 'uninstall_hook', } diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 9def3846bbc..b6436dda885 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -1010,10 +1010,6 @@ class WebsiteSale(http.Controller): PaymentProcessing.remove_payment_transaction(tx) return request.redirect('/shop/confirmation') - @http.route(['/shop/terms'], type='http', auth="public", website=True, sitemap=True) - def terms(self, **kw): - return request.render("website_sale.terms") - @http.route(['/shop/confirmation'], type='http', auth="public", website=True, sitemap=False) def payment_confirmation(self, **post): """ End of checkout process controller. Confirmation is basically seing diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index 75e99de44d5..7d1a378ab4e 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -682,7 +682,7 @@ - -