Files
odoo_source/addons/project
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
..
…
2023-08-17 23:25:14 +02:00
…

Project Management

Infinitely flexible. Incredibly easy to use.

Odoo's collaborative and realtime open source project management helps your team get work done. Keep track of everything, from the big picture to the minute details, from the customer contract to the billing.

Designed to Fit Your Own Process

Organize projects around your own processes. Work on tasks and issues using the kanban view, schedule tasks using the gantt chart and control deadlines in the calendar view. Every project may have its own stages, allowing teams to optimize their job.

Easy to Use

Get organized as fast as you can think. The easy-to-use interface takes no time to learn, and every action is instantaneous, so there’s nothing standing between you and your sweet productive flow.

Work Together

Real-time chats, document sharing, email integration

Use the chatter to communicate with your team or customers and share comments and documents on tasks and issues. Integrate discussion fast with the email integration.

Talk to other users or customers with the website live chat feature.

Collaborative Writing

The power of etherpad, inside your tasks

Collaboratively edit the same specifications or meeting minutes right inside the application. The integrated etherpad feature allows several people to work on the same tasks, at the same time.

This is very efficient for scrum meetings, meeting minutes or complex specifications. Every user has their own color and you can replay the whole creation of the content.

Get Work Done

Get alerts on followed events to stay up to date with what interests you. Use instant green/red visual indicators to scan through what has been done and what requires your attention.

Timesheets, Contracts & Invoicing

Projects are automatically integrated with customer contracts, allowing you to invoice based on time & materials and record timesheets easily.

Track Issues

Single out the issues that arise in a project in order to have a better focus on resolving them. Integrate customer interaction on every issue and get accurate reports on your team's performance.