Files
odoo_source/odoo/addons/test_testing_utilities/ir.model.access.csv
T
Gorash cdaa761ced [REF] base: Update modifier syntax (invisible, required, readonly)
Goal:
* Simplified modifiers to only have one way to define modifiers;
* Remove states attributes on python field;
* Use python expression in view `required`, `readonly`, `invisible`;
* More accurate validation of xml views.

This commit change the syntax to python expression. The next commit
will update/convert all xml views.

Before this commit:
* the `required`, `readonly` and `invisible` attributes can only have
values of `True`, `False`, 1, 0 or a python expression to use the
context;
* the `attrs` attribute define a dict. The key of this dict was
`required`, `readonly` and `invisible` and the values are the domain or
a string representing a domain to be evaluate as python expression.
This python expressions was evaluate by the javascript with view fields
and other contextual values as: context, uid, parent, active_id,
active_ids, active_model, allowed_company_ids, current_company_id.
* the `states` attribute in the view was a comma separated list of the
state. This list was combined with the `invisible` attribute;
* the `invisible` attribute on python field is used as default value;
* the `states` attribute on python field was dictionnary with state as
key and list of tuple. This structure was combined with `readonly` view
attribute.
* After combining, the resulting domains of the different attributes
`required`, `readonly` and `invisible` are evaluated with the values of
the fields. The `invisible` attributes is splitted into two use:
`invisible` and `column_invisible`.

After this commit:
* The attributes `required`, `readonly`, `invisible` and
`column_invisible` define python expression. This python expressions
are evaluate by the javascript with view fields and other contextual
values as: context, uid, parent, active_id, active_ids, active_model,
allowed_company_ids, current_company_id.

The domains can contains contextual value and will be evaluate by the
javascript.

```xml
    <field name="field_a" readonly="not context.get('show_a')" attrs="{'readonly': [('field_b', '!=', False), ('field_c', '=', parent.c)]}"/>
    <field name="field_b" states="draft"/>
```
will be replaced by
```xml
    <field name="field_a" readonly="not context.get('show_a') or field_b and field_c == parent.c"/>
    <field name="field_b" invisible="state != 'draft'"/>
```

Some inherited views will be modified differently in order to maintain
the previous behavior:

```xml
    <field name="field_a" readonly="not context.get('show_a')" attrs="{'invisible': [('field_b', '!=', False)]}">
```
```xml
    <field name="field_a" position="attributes">
        <attribute name="attrs">{'readonly': [('field_c', '=', False)], 'invisible': [('field_d', '!=', '3')]}<attribute>
    </field>
```
will be replaced by
```xml
    <field name="field_a" readonly="not context.get('show_a')" invisible="field_b">
```
```xml
    <field name="field_a" position="attributes">
        <attribute name="readonly" add="(not field_c)" separator=" or "/>
        <attribute name="invisible">field_d != 3<attribute>
    </field>
```

Validation:
A stricter control is made on the level of the attributes (modifiers)
and the fields necessary for these. The use of the previous attributes
'attr' and 'states' triggers an error (these no longer exist after the
application of the migration script)

task-2495504

Part-of: odoo/odoo#104741
2023-08-18 09:49:08 +02:00

3.8 KiB

1idnamemodel_id:idgroup_id:idperm_readperm_writeperm_createperm_unlink
2access_test_testing_utilities_aaccess_test_testing_utilities_amodel_test_testing_utilities_abase.group_user1000
3access_test_testing_utilities_readonlyaccess_test_testing_utilities_readonlymodel_test_testing_utilities_readonlybase.group_user1000
4access_test_testing_utilities_caccess_test_testing_utilities_cmodel_test_testing_utilities_cbase.group_user1000
5access_test_testing_utilities_daccess_test_testing_utilities_dmodel_test_testing_utilities_dbase.group_user1000
6access_test_testing_utilities_eaccess_test_testing_utilities_emodel_test_testing_utilities_ebase.group_user1000
7access_test_testing_utilities_faccess_test_testing_utilities_fmodel_test_testing_utilities_fbase.group_user1000
8access_test_testing_utilities_gaccess_test_testing_utilities_gmodel_test_testing_utilities_gbase.group_user1000
9access_test_testing_utilities_m2oaccess_test_testing_utilities_m2omodel_test_testing_utilities_m2obase.group_user1000
10access_test_testing_utilities_defaultaccess_test_testing_utilities_defaultmodel_test_testing_utilities_defaultbase.group_user1000
11access_test_testing_utilities_parentaccess_test_testing_utilities_parentmodel_test_testing_utilities_parentbase.group_user1000
12access_test_testing_utilities_subaccess_test_testing_utilities_submodel_test_testing_utilities_subbase.group_user1000
13access_test_testing_utilities_refaccess_test_testing_utilities_refmodel_test_testing_utilities_refbase.group_user1000
14access_test_testing_utilities_ref_subaccess_test_testing_utilities_ref_submodel_test_testing_utilities_ref_subbase.group_user1000
15access_test_testing_utilities_sub2access_test_testing_utilities_sub2model_test_testing_utilities_sub2base.group_user1000
16access_test_testing_utilities_sub3access_test_testing_utilities_sub3model_test_testing_utilities_sub3base.group_user1000
17access_test_testing_utilities_recursiveaccess_test_testing_utilities_recursivemodel_test_testing_utilities_recursivebase.group_user1000
18access_test_testing_utilities_onchange_parentaccess_test_testing_utilities_onchange_parentmodel_test_testing_utilities_onchange_parentbase.group_user1000
19access_test_testing_utilities_onchange_lineaccess_test_testing_utilities_onchange_linemodel_test_testing_utilities_onchange_linebase.group_user1000
20access_model_test_testing_utilities_onchange_countaccess_model_test_testing_utilities_onchange_countmodel_test_testing_utilities_onchange_countbase.group_user1111
21access_test_testing_utilities_onchange_count_subaccess_test_testing_utilities_onchange_count_submodel_test_testing_utilities_onchange_count_subbase.group_user1111
22access_o2m_readonly_subfield_parentaccess_o2m_readonly_subfield_parentmodel_o2m_readonly_subfield_parentbase.group_user1111
23access_o2m_readonly_subfield_childaccess_o2m_readonly_subfield_childmodel_o2m_readonly_subfield_childbase.group_user1111
24access_test_testing_utilities_req_boolaccess_test_testing_utilities_req_boolmodel_test_testing_utilities_req_boolbase.group_user1000
25access_o2m_changes_parentaccess_o2m_changes_parentmodel_o2m_changes_parentbase.group_user1000
26access_o2m_changes_childrenaccess_o2m_changes_childrenmodel_o2m_changes_childrenbase.group_user1000
27access_o2m_changes_children_linesaccess_o2m_changes_children_linesmodel_o2m_changes_children_linesbase.group_user1000
28access_ttu_productaccess_ttu_productmodel_ttu_productbase.group_user1000
29access_ttu_rootaccess_ttu_rootmodel_ttu_rootbase.group_user1000
30access_ttu_childaccess_ttu_childmodel_ttu_childbase.group_user1000
31access_ttu_grandchildaccess_ttu_grandchildmodel_ttu_grandchildbase.group_user1000
32access_res_config_testaccess_res_config_testtest_testing_utilities.model_res_config_testbase.group_user1000