-
Notifications
You must be signed in to change notification settings - Fork 106
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
[10.0][FIX] fix issue when creating binding from the main record #607
[10.0][FIX] fix issue when creating binding from the main record #607
Conversation
5cb868b
to
40aada4
Compare
Codecov Report
@@ Coverage Diff @@
## 10.0 #607 +/- ##
==========================================
+ Coverage 90.39% 90.45% +0.06%
==========================================
Files 151 151
Lines 4048 4054 +6
==========================================
+ Hits 3659 3667 +8
+ Misses 389 387 -2
Continue to review full report at Codecov.
|
40aada4
to
9e342c2
Compare
Indeed the implementation of write on one2many (see odoo/fields.py:2235) call the method create/write in mode norecompute This mean that the field is_urls_sync_required is not computed after the call to super of write/create of the binding but later during the create/write of the main record. To solve the issue we sync the url after calling the method "_recompute_done". This also simplify the code \o/
2e65a6a
to
9264bb2
Compare
After several hours of fight again several issue when loading fake class I try to implement a new version. Indeed fake model that inherit existing class was not loading the field correctly (if you active the option custom='manual', field are not loaded correctly, if you do not active it field still exist in the registry). Try an alternative approche. For now to not merge yet. Play with the same code here : OCA/search-engine#46 |
which issue did you have? |
@simahawk I have seen this hack I try to remove custom option but I was not able to purge the registry correctly. As the file "model" is loaded at python execution the odoo class are already processed. When we call the _build_model it will register for ever the ResPartnerFake into the registry 'by modifying the base property of the registry['res.partner'] (you can see it this by looking in registry['res.partner'].mro()). |
I will work on it at this end of the week and try to publish the code in a python lib compatible for odoo 10/11/12/13 so we can reuse it everywhere without copy/paste |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this fix in v12.
The binding issue was not related to this fix. But since it looks to be shorter and cleaner I approve it :-)
Btw the problem (at least in v12) was in automatic_url_key calc definition. I will provide a patch soon. After my fix, and this one, it works well.
[EDIT]: I've tested with my fix and without this one, and it's true this fix resolve another issue. So both fixes are needed.
8eb628f
to
78afce8
Compare
@simahawk it's done now we have a generic helper for loading fake model https://github.com/akretion/odoo-test-helper working on version 10, 11, 12, 13 ! |
great! Some things missing (eg: xmlid generation, ACL generation, etc) but it's good start! |
This PR has the |
@sebastienbeau I'm testing the test helper somewhere else. I found some issue -> I'll open a PR. |
@sebastienbeau I'm a little overwhelmed at the moment but it would be nice in your library to take credit for this work on Simone and me too. I've spent a lot of time on it and as far as I know I'm the original author of this code. Friendly, lmi |
👍 I planned to open a PR for this 😉 |
I also think OCA will be the best place. |
OCA is fine, that's the final plan. I only said "before pushing for OCA adoption" ;) |
78afce8
to
f387422
Compare
f387422
to
9e0b939
Compare
/ocabot merge minor |
On my way to merge this fine PR! |
Congratulations, your PR was merged at d9accf6. Thanks a lot for contributing to shopinvader. ❤️ |
Indeed the implementation of write on one2many (see odoo/fields.py:2235)
call the method create/write in mode norecompute
This mean that the field is_urls_sync_required is not computed after
the call to super of write/create of the binding but later during the
create/write of the main record.
To solve the issue we sync the url after calling the method
"_recompute_done".
This also simplify the code \o/