odoo/odoo#123851

Created by fw-bot
Merged at f40ab7c811ee2212599939a36feb9c48320dbe46

Statuses:

label
odoo-dev:master-15.0-opw-3268947-aab-jl-R-fw
head
7fd434aeb4af5feb1683f868d515b18cdf3e440e
merged
2 years ago by JavaScript, Aaron Bohy (aab)
odoo/odoo
15.0 #123274
saas-15.2 #123390
16.0 #123394
saas-16.1 #123397
saas-16.2 #123400
saas-16.3 #123751
17.0
18.0
saas-18.2
saas-18.3
saas-18.4
master #123851

[FW][FIX] web: BasicModel: clear x2many changes after save

Before this commit, after a save, we didn't remove the changes in x2many fields (StaticList). As a consequence, if save was called twice on a record with changes in a x2many, those changes were sent twice to the server. In particular, if those changes involved a command 0 (create), the record was created twice.

To reproduce the issue, go to a sale order, add a line, select a product, click out to validate the row, then click several times on the product. As you clicked several times, several doAction are asked to the action service. For each of them, the form view is asked to save its changes, and thus the same row is created multiple times.

After this fix, the changes in x2manys are cleared after the first save, so there's no change the save for the subsequent calls.

opw-3268947
opw-3324848

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #123751
Forward-Port-Of: #123274