The goal of this revision is to re-use the environment among the
different steps of the registry loading,
instead of creating a new environment for each step.
1. Simply To avoid to repeat the line
`env = api.Environment(cr, SUPERUSER_ID, {})`
multiple times in the code
2. This also allows to share the context among the different
steps. This is not yet used in this revision, but it could
be, for instance to avoid the current repetition to add the keys
`install_module`, in `convert_csv_import` and `xml_import._tag_record`
Part-of: odoo/odoo#108254
22 lines
539 B
Python
22 lines
539 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models
|
|
from odoo.modules.loading import force_demo
|
|
from odoo.addons.base.models.ir_module import assert_log_admin_access
|
|
|
|
|
|
class IrDemo(models.TransientModel):
|
|
|
|
_name = 'ir.demo'
|
|
_description = 'Demo'
|
|
|
|
@assert_log_admin_access
|
|
def install_demo(self):
|
|
force_demo(self.env)
|
|
return {
|
|
'type': 'ir.actions.act_url',
|
|
'target': 'self',
|
|
'url': '/web',
|
|
}
|