Default Main Engine
Create a many2one field and get the 1st line from one2many/many2many/json field to consider as the main one
STORY BEHIND THE FEATURES
ODOO BEHAVIOR
Odoo has multiple types of linked fields, which allows you to have different type of relationship: many2one, one2many, many2many etc.
However, with the one2many or many2many relationship, we cannot easily make the search or group by these information.
Odoo 16 update
For analytics field (analytic_distribution), Odoo uses json instead of x2many.
CLUEDOO BEHAVIOR
Cluedoo considers the 1st line in the relation one2many/many2many as the default main line.
With this module, we can easily create a many2one field by Studio, and get the data from the 1st line in these abovementioned fields. By doing this, we can extract information, make filter and group by easily.
Odoo 16 update
Cluedoo make this json field take any first record of analytic_distribution then put it to many2one field from studio
CLUEDOO RECOMMENDATIONS
To be installed in 100% of your database as it is an useful tool for data management.
Want to get Clued into Cluedoo?
HOW TO USE THIS MODULE?
X2many function
1. In developer mode, by using Studio, add many2one field, select relation (ex: Sales Order Lines)
2. In the field settings, we can make relation to one2many object and automatically, the new field will have python code and computed field
3. The new field will take the first record of one2many object
Json function
1. On Sales Order, in developer mode, by using Studio, click on Order Lines, click "Edit List View"
2. On New Fields, drag "Many2one" to add a new field in Order Lines.
3. On "Field Properties" wizard, select an analytics relation, for example "Analytic Account" and confirm.
4. Now "Analytic Account" field is added as a column. Select "More" to edit field.
5. Select Main Record of JSON as "Analytic (Sales Order Line)". Advanced properties will be automatically updated.
Save and close studio.
6. Create a new Sales Order and assign analytic accounts to order line.
"Analytic Account" field will take the first record of "Analytic" field.