Skip to content

Commit

Permalink
[MIG] base_export_manager: Migration to 17
Browse files Browse the repository at this point in the history
  • Loading branch information
david-s73 committed Oct 24, 2024
1 parent 811f9e6 commit 7568f0d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion base_export_manager/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "Manage model export profiles",
"category": "Personalization",
"version": "16.0.1.0.1",
"version": "17.0.1.0.0",
"depends": ["web"],
"data": [
"views/ir_exports.xml",
Expand Down
5 changes: 2 additions & 3 deletions base_export_manager/hooks.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import SUPERUSER_ID, api
from odoo import api


def post_init_hook(cr, registry):
def post_init_hook(env):
"""Loaded after installing the module.
``ir.exports.line.name`` was before a char field, and now it is a computed
char field with stored values. We have to inverse it to avoid database
inconsistencies.
"""
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
env["ir.exports.line"].search(

Check warning on line 14 in base_export_manager/hooks.py

View check run for this annotation

Codecov / codecov/patch

base_export_manager/hooks.py#L14

Added line #L14 was not covered by tests
[
("field1_id", "=", False),
Expand Down
2 changes: 1 addition & 1 deletion base_export_manager/models/ir_model_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ class IrModelAccess(models.Model):
_inherit = "ir.model.access"

# WARN: This can't be used in 'check()'
# See https://github.com/odoo/odoo/blob/0b6a2569920b6584652c39b3465998649fe305b4/odoo/addons/base/models/ir_model.py#L1496 # noqa: B950
# See https://github.com/odoo/odoo/blob/0b6a2569920b6584652c39b3465998649fe305b4/odoo/addons/base/models/ir_model.py#L1496 # noqa: E501
perm_export = fields.Boolean("Export Access", default=True)
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/** @odoo-module **/

import {ListController} from "@web/views/list/list_controller";
const {onWillRender} = owl;
import {onWillRender} from "@odoo/owl";
import {patch} from "@web/core/utils/patch";
import {session} from "@web/session";

patch(ListController.prototype, "base_export_manager", {
patch(ListController.prototype, {
setup() {
this._super(...arguments);
super.setup(...arguments);
onWillRender(async () => {
if (this.isExportEnable) {
const is_export_enabled =
Expand Down
14 changes: 7 additions & 7 deletions base_export_manager/views/ir_exports.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
>
<tree editable="bottom">
<field name="sequence" widget="handle" />
<field name="model1_id" invisible="True" />
<field name="model2_id" invisible="True" />
<field name="model3_id" invisible="True" />
<field name="model4_id" invisible="True" />
<field name="model1_id" column_invisible="1" />
<field name="model2_id" column_invisible="1" />
<field name="model3_id" column_invisible="1" />
<field name="model4_id" column_invisible="1" />
<field name="label" />
<field name="name" readonly="1" />
<field
Expand All @@ -57,17 +57,17 @@
/>
<field
name="field2_id"
attrs="{'readonly': [('model2_id', '=', False)]}"
readonly="not model2_id"
options="{'no_open': True, 'no_create': True}"
/>
<field
name="field3_id"
attrs="{'readonly': [('model3_id', '=', False)]}"
readonly="not model3_id"
options="{'no_open': True, 'no_create': True}"
/>
<field
name="field4_id"
attrs="{'readonly': [('model3_id', '=', False)]}"
readonly="not model3_id"
options="{'no_open': True, 'no_create': True}"
/>
</tree>
Expand Down

0 comments on commit 7568f0d

Please sign in to comment.