[FIX] web: fix studio child view datapoint content

Issue

    - Install Employees & Studio
    - Configuration > Check Skills Management
    - Go on an employee form
    - Remove all data in Experience, Education & Skills
    - Open Studio
    - Click in the blank space before Skills
    - Edit Form View

    Traceback

Cause

    The ORM tries to get the parent fields because the generated
    datapoint includes them. (45bc7c9)

    Normally the parent model is the same than the child model
    but not in studio.

Solution

    Merging the fields in the datapoint only if the models are the same.

OPW-2125214

closes odoo/odoo#43695

X-original-commit: d2dbc4faaad0988d71f591be7f50c94d455541b0
Related: odoo/enterprise#7849
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Jason Van Malder
2020-01-21 18:14:23 +00:00
committed by Nicolas Martinelli
parent 13c1f4fa34
commit e6fa563222
@@ -3980,7 +3980,8 @@ var BasicModel = AbstractModel.extend({
// Fields that are present in the originating view, that need to be initialized
// Hence preventing their value to crash when getting back to the originating view
var parentRecord = self.localData[params.parentID];
var parentRecord = params.parentID && this.localData[params.parentID].type === 'list' ? this.localData[params.parentID] : null;
if (parentRecord) {
var originView = parentRecord.viewType;
fieldNames = _.union(fieldNames, Object.keys(parentRecord.fieldsInfo[originView]));