[ADD] pms: Added init_hook.py to activate advanced pricelist when pms is installed

This commit is contained in:
Brais Abeijón
2020-11-06 15:36:46 +01:00
parent 4891c4de7c
commit 91aa2d55f8
3 changed files with 12 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
from .init_hook import post_init_hook
# from . import wizard

View File

@@ -72,4 +72,5 @@
"qweb": [
"static/src/xml/pms_base_templates.xml",
],
"post_init_hook": "post_init_hook",
}

10
pms/init_hook.py Normal file
View File

@@ -0,0 +1,10 @@
from odoo import SUPERUSER_ID
from odoo.api import Environment
def post_init_hook(cr, _):
with Environment.manage():
env = Environment(cr, SUPERUSER_ID, {})
env["ir.config_parameter"].sudo().set_param(
"product.product_pricelist_setting", "Advance"
)