Skip to content

Commit

Permalink
[MIG] server_action_mass_edit: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rov-adhoc committed Feb 1, 2024
1 parent 415c3ff commit 4cb934f
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 74 deletions.
2 changes: 1 addition & 1 deletion server_action_mass_edit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Mass Editing",
"version": "16.0.2.0.1",
"version": "17.0.1.0.0",
"author": "Serpent Consulting Services Pvt. Ltd., "
"Tecnativa, "
"GRAP, "
Expand Down
20 changes: 0 additions & 20 deletions server_action_mass_edit/migrations/16.0.2.0.0/pre-migration.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError

MAGIC_FIELDS = models.MAGIC_COLUMNS + [models.BaseModel.CONCURRENCY_CHECK_FIELD]
MAGIC_FIELDS = models.MAGIC_COLUMNS


class IrActionsServerMassEditLine(models.Model):
Expand Down
4 changes: 1 addition & 3 deletions server_action_mass_edit/tests/test_mass_editing.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def test_wiz_read_fields(self):
self.mass_editing_user, self.users, vals
)
result = mass_wizard.read(fields)[0]

self.assertTrue(
all([field in result for field in fields]), "Read must return all fields."
)
Expand Down Expand Up @@ -333,9 +334,6 @@ def test_onchanges(self):
self.assertEqual(mass_edit_line_form.widget_option, "image")
mass_edit_line_form.field_id = self.env.ref("base.field_res_company__logo")
self.assertEqual(mass_edit_line_form.widget_option, "image")
# binary
mass_edit_line_form.field_id = self.env.ref("base.field_res_company__favicon")
self.assertEqual(mass_edit_line_form.widget_option, False)

mass_edit_line_form.field_id = self.env.ref("base.field_res_users__country_id")
self.assertFalse(mass_edit_line_form.widget_option)
Expand Down
77 changes: 40 additions & 37 deletions server_action_mass_edit/views/ir_actions_server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,49 @@
<odoo>

<record id="view_server_action_form" model="ir.ui.view">
<field name="name">ir.actions.server.mass_edit.inherited</field>
<field name="model">ir.actions.server</field>
<field name="inherit_id" ref="base.view_server_action_form" />
<field name="arch" type="xml">
<page name="security" position="before">
<page
name="mass_edit_line_ids"
string="Fields"
attrs="{'invisible': [('state', '!=', 'mass_edit')]}"
>
<field name="mass_edit_line_ids" nolabel="1">
<tree editable="bottom">
<field name="model_id" invisible="1" />
<field name="server_action_id" invisible="1" />
<field name="sequence" widget="handle" />
<field
name="field_id"
options="{'no_create': True, 'no_create_edit': True}"
/>
<field name="widget_option" />
<field name="apply_domain" />
</tree>
</field>
<field name="mass_edit_apply_domain_in_lines" invisible="1" />
<div
colspan="2"
class="text-warning"
attrs="{'invisible': [('mass_edit_apply_domain_in_lines', '=', False)]}"
>
<b
>WARNING</b>: Take into account that adding a field with a domain, and not including the fields of such domain in this operation definition, will lead to an error when trying to perform it. Make sure you include them.
</div>
</page>
<page
name="mass_edit_message"
string="Message"
attrs="{'invisible': [('state', '!=', 'mass_edit')]}"
>
<field name="mass_edit_message" />
</page>
</page>

<sheet position="inside">
<notebook invisible="state != 'mass_edit'">
<page name="mass_edit_line_ids" string="Fields">
<field name="mass_edit_line_ids" nolabel="1">
<tree editable="bottom">
<field name="model_id" column_invisible="True" />
<field
name="server_action_id"
column_invisible="True"
/>
<field name="sequence" widget="handle" />
<field
name="field_id"
options="{'no_create': True, 'no_create_edit': True}"
/>
<field name="widget_option" />
<field name="apply_domain" />
</tree>
</field>
<field name="mass_edit_apply_domain_in_lines" invisible="1" />
<div
colspan="2"
class="text-warning"
invisible="not mass_edit_apply_domain_in_lines"
>
<b
>WARNING</b>: Take into account that adding a field with a domain, and not including the fields of such domain in this operation definition, will lead to an error when trying to perform it. Make sure you include them.
</div>
</page>
<page name="mass_edit_message" string="Message">
<field name="mass_edit_message" />
</page>
</notebook>


</sheet>


</field>
</record>

Expand Down
6 changes: 4 additions & 2 deletions server_action_mass_edit/wizard/mass_editing_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def default_get(self, fields, active_ids=None):
}
elif len(original_active_ids):
operation_description_warning = _(
"You have selected %(origin_amount)d record(s) that can not be processed.\n"
"You have selected %(origin_amount)d "
"record(s) that can not be processed.\n"
"Only %(amount)d record(s) will be processed."
) % {
"origin_amount": len(original_active_ids) - len(active_ids),
Expand Down Expand Up @@ -147,7 +148,8 @@ def _insert_field_in_arch(self, line, field, main_xml_group):
def _get_field_options(self, field):
return {
"name": field.name,
"modifiers": '{"invisible": [["selection__%s", "in", ["ignore", "remove"]]]}'
"modifiers": '{"invisible": "\
"[["selection__%s", "in", ["ignore", "remove"]]]}'
% field.name,
"class": "w-75",
}
Expand Down
14 changes: 4 additions & 10 deletions server_action_mass_edit/wizard/mass_editing_wizard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,27 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<field name="arch" type="xml">
<form>
<header />
<p
class="oe_grey"
attrs="{'invisible':
[('message', '=', False)]}"
>
<p class="oe_grey" invisible="not message">
<field name="message" />
</p>
<p
class="alert alert-info"
role="alert"
attrs="{'invisible':
[('operation_description_info', '=', False)]}"
invisible="not operation_description_info"
>
<field name="operation_description_info" />
</p>
<p
class="alert alert-warning"
role="alert"
attrs="{'invisible':
[('operation_description_warning', '=', False)]}"
invisible="not operation_description_warning"
>
<field name="operation_description_warning" />
</p>
<p
class="alert alert-danger"
role="alert"
attrs="{'invisible': [('operation_description_danger', '=', False)]}"
invisible="not operation_description_danger"
>
<field name="operation_description_danger" />
</p>
Expand Down

0 comments on commit 4cb934f

Please sign in to comment.