odoo/odoo#123397

Created by fw-bot
Merged at d0e0cd8098b4f6b37fd827ca12b6c081722d5683

Statuses:

label
odoo-dev:saas-16.1-15.0-opw-3268947-aab-ardl-fw
head
345d09471f8a70a9600f559e05b8b8d8fe3543ef
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: #123274