Skip to content

[FIX][database_cleanup] don't destroy values when there are empty default properties - #1506

Merged
pedrobaeza merged 4 commits into
OCA:10.0from
hbrunn:10.0-database_cleanup-fix_false_default_properties
Mar 11, 2019
Merged

[FIX][database_cleanup] don't destroy values when there are empty default properties#1506
pedrobaeza merged 4 commits into
OCA:10.0from
hbrunn:10.0-database_cleanup-fix_false_default_properties

Conversation

@hbrunn

@hbrunn hbrunn commented Feb 11, 2019

Copy link
Copy Markdown
Member

when you have a default property with a falsy value, the cleanup will go very wrong because it will delete all your properties.

The right thing to do in such a case is to remove the empty default value.

This one we should cherry pick back and forth through the versions.

I also slipped in a cosmetic fix for display of redundant properties, this was always showing False. Last thing I fixed while being at this PR is that the action to purge just a selection of lines was migrated wrongly to 10 (and the following)

@hbrunn hbrunn added this to the 10.0 milestone Feb 11, 2019
@pedrobaeza

Copy link
Copy Markdown
Member

Please check Travis

@hbrunn

hbrunn commented Feb 11, 2019

Copy link
Copy Markdown
Member Author

looks like a general failure, 10.0 also fails there: https://travis-ci.org/OCA/server-tools/builds/486443599

@pedrobaeza

Copy link
Copy Markdown
Member

OK, I see... it's a problem in auth_brute_force since the merge of odoo/odoo#30768

@hbrunn

hbrunn commented Feb 11, 2019

Copy link
Copy Markdown
Member Author

aha, thanks for the link. I still believe odoo/odoo#20033 would be a better patch...

@pedrobaeza

Copy link
Copy Markdown
Member

Are they complementary or replaceable? I'd say for pushing on reviewing your PR.

@christophlsa

Copy link
Copy Markdown
Member

OK, I see... it's a problem in auth_brute_force since the merge of odoo/odoo#30768

@pedrobaeza @hbrunn Is there already a ticket for the issue with the failing unit tests? We were also seeing the failing tests but I couldn't fix it. I could just find out that the changes by the function "_auth_attempt_update" were not recognized or were not in effect at the point where the unit test is failing. I printed all three records in res.authentication.attempt but all three have still the result False instead of 'failed'.

@pedrobaeza

Copy link
Copy Markdown
Member

@christophlsa we have been investigating locally, but also without success for now. At the end, we were using a hack, and the hack is no more possible due to the changes. One possible workaround for now is to disable that tests for having a green branch and re-enable them when fixed.

@hbrunn

hbrunn commented Feb 22, 2019

Copy link
Copy Markdown
Member Author

let's don't work around like that. I put this on my list to look at (no promise on delivery time)

@hbrunn

hbrunn commented Feb 25, 2019

Copy link
Copy Markdown
Member Author

I spent a while on this, we really need stackable context manager cursors for this to ever work properly. We can patch away a few rollbacks at some places in the tests and then it doesn't fail, but then we don't really test what we should test

@pedrobaeza

Copy link
Copy Markdown
Member

Mocks aren't an option?

@hbrunn

hbrunn commented Feb 25, 2019

Copy link
Copy Markdown
Member Author

not really. When you rewrite most of the module from using context managers to committing/rolling back the transactions manually, it should be possible to make this work

@StefanRijnhart

StefanRijnhart commented Mar 7, 2019

Copy link
Copy Markdown
Member

@hbrunn you are right, your nestable TestCursor seems to fix fixes the tests. I am applying it here: https://github.com/OCA/server-tools/pull/1526/files

@pedrobaeza

Copy link
Copy Markdown
Member

Please squash last 2 commits and take the occasion to rebase as now main branch is green

@hbrunn
hbrunn force-pushed the 10.0-database_cleanup-fix_false_default_properties branch from 541ea0e to 0f5c494 Compare March 11, 2019 13:11
@hbrunn

hbrunn commented Mar 11, 2019

Copy link
Copy Markdown
Member Author

@pedrobaeza done
@StefanRijnhart cool! any complaints that I yank this into https://github.com/OCA/oca-decorators if ever need arises in some other repo?

@pedrobaeza
pedrobaeza merged commit 1245634 into OCA:10.0 Mar 11, 2019
@StefanRijnhart

StefanRijnhart commented Mar 11, 2019

Copy link
Copy Markdown
Member

@hbrunn no, go ahead! And thanks for the original work!

SiesslPhillip pushed a commit to grueneerde/OCA-server-tools that referenced this pull request Nov 20, 2024
Syncing from upstream OCA/server-tools (16.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants