Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17][BUG] Onchange of computed o2m field leaves initially loaded records #164520

Open
dz0 opened this issue May 6, 2024 · 2 comments
Open

[17][BUG] Onchange of computed o2m field leaves initially loaded records #164520

dz0 opened this issue May 6, 2024 · 2 comments
Labels
17.0 ORM ORM, python Framework related

Comments

@dz0
Copy link

dz0 commented May 6, 2024

Impacted versions: 17.0

Steps to reproduce:

    1. having computed One2Many child_ids (minimal example src)
    1. create a "Parent" record with number=2
    1. open it in form view
      paveikslas
    1. change number to 1
      paveikslas
    1. change number again (let's say to 3)
      paveikslas

Current behavior:

  • initial 2 rows stay, but the other ones keep being changed

Expected behavior:

  • initial rows should also be removed on first change of number
@dz0
Copy link
Author

dz0 commented May 6, 2024

Noticed when migrating from v13.0,

digging bit, I found the new onchange trying to be smart -- https://github.com/odoo/odoo/pull/119510/files/#diff-1a4d514ed8aaa48bfdaf205130a09ccc3645c905369f35c1bd83b8dc2c2e3bc7R1145

Instead of returning full list, it returns Command.DELTETE for previous items, that should not be shown... and Command.CREATE or Command.LINK for the new ones..
I didn't find the JS code for handling onchange, but using dev-tools request inspection,
noticed, that JS tracks the changed fields in the form, and sends them back to server, so it knows to refresh them or so.

But JS part misses the case for initially loaded items that need to be "refreshed"/removed.

@dz0
Copy link
Author

dz0 commented May 6, 2024

As very dumb workaround I can overwrite onchange - see commented out part

@dz0 dz0 changed the title onchange of computed o2m field leaves initially loaded records [17][BUG] Onchange of computed o2m field leaves initially loaded records May 6, 2024
@vava-odoo vava-odoo added ORM ORM, python Framework related 17.0 labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
17.0 ORM ORM, python Framework related
Projects
None yet
Development

No branches or pull requests

2 participants