[MIG] 10.0 db cleanup#894
Conversation
|
Please squash together "OCA Transbot" commits. |
* [FIX] database_cleanup: Isolate build * Isolate `database_cleanup` into its own build in Travis file to fix OCA#689 * [FIX] database_cleanup: Remove KeyError assertion * Remove KeyError assertion in tests due to PR in comment being merged
* [ADD] allow creating missing indexes * [FIX] tests; installation * [ADD] allow purging properties * [ADD] missing file * [ADD] test purging properties * [ADD] missing parent_id for menu entry * [FIX] don't delete too many and wrong properties
|
Squashed some transbot commits (not all to preserve the order) |
|
Strange that no ir.property are present in the test database, tests are failing because of this. Any ideas? |
|
Create some of them in your setUp phase to see |
0d9210c to
a958d8c
Compare
|
Tests are fixed 😄 |
| ], | ||
| 'installable': False, | ||
| 'installable': True, | ||
| "application": True, |
| <field name="type">ir.actions.server</field> | ||
| <field name="state">code</field> | ||
| <field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_property" /> | ||
| <field name="code">action = self.get_wizard_action(cr, uid, context=context)</field> |
There was a problem hiding this comment.
I get spurious errors
ValueError: <type 'exceptions.NameError'>: "name 'self' is not defined" while evaluating u'action = self.get_wizard_action(cr, uid, context=context)'
when clicking on some of the menu items. It seems to help to replace the code contents of lines like this with
action = env['cleanup.purge.wizard.property'].get_wizard_action()
There was a problem hiding this comment.
Thanks! You missed one, the one I referred to initially.
There was a problem hiding this comment.
Sorry for that, it's now included
| </footer> | ||
| </form> | ||
| <div attrs="{'invisible': [('purge_line_ids', '!=', [])]}"> | ||
| Nothing found to clean up. |
There was a problem hiding this comment.
I tried to figure out how to fix it but didn't came out with a working solution. By inspecting odoo source code I found code which is exactly the same as here. Any help from others would be appreciated.
There was a problem hiding this comment.
The problem is that the div is in the field tag itself. It works when the div is moved before the field tag.
9176134 to
28c6d37
Compare
| <field name="type">ir.actions.server</field> | ||
| <field name="state">code</field> | ||
| <field name="model_id" ref="database_cleanup.model_cleanup_create_indexes_wizard" /> | ||
| <field name="code">action = env.get('cleanup.purge.wizard.data').get_wizard_action()</field> |
There was a problem hiding this comment.
Wrong model. Should be 'cleanup.create_indexes.wizard'
| <field name="type">ir.actions.server</field> | ||
| <field name="state">code</field> | ||
| <field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_property" /> | ||
| <field name="code">action = env.get('cleanup.purge.wizard.data').get_wizard_action()</field> |
There was a problem hiding this comment.
Wrong model. Should be 'cleanup.purge.wizard.property'
Using new base model inheritance.
StefanRijnhart
left a comment
There was a problem hiding this comment.
Thanks for all the quick fixes!
There was a problem hiding this comment.
small things. I also made CompassionCH#1 for an issue when purging modules
| if not self.env.cr.rowcount: | ||
| continue | ||
|
|
||
| yield (0, 0, { |
There was a problem hiding this comment.
what was the problem with the iterator?
| for line in self: | ||
| if self: | ||
| objs = self | ||
| else: |
There was a problem hiding this comment.
if this happens, I think something went wrong in the UI. How can I reproduce this?
There was a problem hiding this comment.
PS: If you really need this for whatever reason, just assign to self and leave the rest of the code as it is. It's just a variable like any other
| # The super method crashes if the model cannot be instantiated | ||
| if self.env.context.get('no_prepare_update'): | ||
| return True | ||
| return super(IrModelFields, self)._prepare_update() |
There was a problem hiding this comment.
can't you filter self for existing models as done above? This also would make the extra context key unnecessary
[FIX] really uninstall modules and avoid a crash on cached data
|
@moylop260 I missed those comments, I will look into it when I have time. |
|
@ecino I addressed those in CompassionCH#2 |
10.0 database cleanup
|
thanks @hbrunn, I merged your commits. |
Syncing from upstream OCA/server-tools (15.0)

Takes #607 with 9.0 commits for module database_cleanup.