Purpose of the task is, to use our awesome website builder instead of pad when creating a website page for terms & condition. Also suggest default T&C to save user time when user enable the feature So in this commit did the below changes: * Added new indicational text below "Terms as note" & "Terms as web page" * After enabling "Term as web page', user should be able to see the term page url * For Terms editing: - User that have 'website' or 'ecommerce' module should edit the page directly using the website builder with link "edit in website builder" link. - User that don't have nor website not ecommerce module should update the text in the pad but in a pop-up window. * Also added the dynamic default term for company when term type is html. PS: changed website_sale pre_init_hook to post_init_hook because invoice_terms_html is compute field which depends on term_type so when term_type is changed from init_hook it will give the key error for the invoice_terms_html as it's not loaded to registry. closes odoo/odoo#68225 Taskid: 2414659 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
29 lines
1.2 KiB
Python
29 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
from odoo import api, SUPERUSER_ID, _
|
|
from . import controllers
|
|
from . import models
|
|
from . import wizard
|
|
from . import report
|
|
|
|
def _post_init_hook(cr, registry):
|
|
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'
|
|
|
|
|
|
def uninstall_hook(cr, registry):
|
|
''' Need to reenable the `product` pricelist multi-company rule that were
|
|
disabled to be 'overridden' for multi-website purpose
|
|
'''
|
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
pl_rule = env.ref('product.product_pricelist_comp_rule', raise_if_not_found=False)
|
|
pl_item_rule = env.ref('product.product_pricelist_item_comp_rule', raise_if_not_found=False)
|
|
multi_company_rules = pl_rule or env['ir.rule']
|
|
multi_company_rules += pl_item_rule or env['ir.rule']
|
|
multi_company_rules.write({'active': True})
|