Skip to content

Commit

Permalink
Merge pull request OCA#158 from hbrunn/8.0-database_cleanup_fixes
Browse files Browse the repository at this point in the history
[IMP] hide unnecessary buttons in wizard
  • Loading branch information
gurneyalex committed May 20, 2015
2 parents b6f9201 + 3a585e5 commit 678ac7b
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 27 deletions.
4 changes: 2 additions & 2 deletions database_cleanup/model/purge_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def find(self, cr, uid, context=None):
SELECT id FROM ir_model_data
WHERE model = %%s
AND res_id IS NOT NULL
AND res_id NOT IN (
SELECT id FROM %s)
AND NOT EXISTS (
SELECT id FROM %s WHERE id=ir_model_data.res_id)
""" % self.pool[model]._table, (model,))
data_ids += [data_row[0] for data_row in cr.fetchall()]
data_ids += data_pool.search(
Expand Down
1 change: 1 addition & 0 deletions database_cleanup/model/purge_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
class CleanupPurgeLine(orm.AbstractModel):
""" Abstract base class for the purge wizard lines """
_name = 'cleanup.purge.line'
_order = 'name'
_columns = {
'name': fields.char('Name', size=256, readonly=True),
'purged': fields.boolean('Purged', readonly=True),
Expand Down
22 changes: 17 additions & 5 deletions database_cleanup/view/purge_columns.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,24 @@
</field>
</record>

<record id="action_purge_columns" model="ir.actions.act_window">
<record id="action_purge_columns" model="ir.actions.server">
<field name="name">Purge columns</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cleanup.purge.wizard.column</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_column" />
<field name="code">
wizard_id = self.create(cr, uid, {}, context=context)
action = {
'type': 'ir.actions.act_window',
'views': [(False, 'form')],
'res_model': 'cleanup.purge.wizard.column',
'res_id': wizard_id,
'flags': {
'action_buttons': False,
'sidebar': False,
},
}
</field>
</record>

</data>
Expand Down
22 changes: 17 additions & 5 deletions database_cleanup/view/purge_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,24 @@
</field>
</record>

<record id="action_purge_data" model="ir.actions.act_window">
<record id="action_purge_data" model="ir.actions.server">
<field name="name">Purge data entries that refer to missing resources</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cleanup.purge.wizard.data</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_data" />
<field name="code">
wizard_id = self.create(cr, uid, {}, context=context)
action = {
'type': 'ir.actions.act_window',
'views': [(False, 'form')],
'res_model': 'cleanup.purge.wizard.data',
'res_id': wizard_id,
'flags': {
'action_buttons': False,
'sidebar': False,
},
}
</field>
</record>

</data>
Expand Down
22 changes: 17 additions & 5 deletions database_cleanup/view/purge_models.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,24 @@
</field>
</record>

<record id="action_purge_models" model="ir.actions.act_window">
<record id="action_purge_models" model="ir.actions.server">
<field name="name">Purge models</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cleanup.purge.wizard.model</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_model" />
<field name="code">
wizard_id = self.create(cr, uid, {}, context=context)
action = {
'type': 'ir.actions.act_window',
'views': [(False, 'form')],
'res_model': 'cleanup.purge.wizard.model',
'res_id': wizard_id,
'flags': {
'action_buttons': False,
'sidebar': False,
},
}
</field>
</record>

</data>
Expand Down
22 changes: 17 additions & 5 deletions database_cleanup/view/purge_modules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,24 @@
</field>
</record>

<record id="action_purge_modules" model="ir.actions.act_window">
<record id="action_purge_modules" model="ir.actions.server">
<field name="name">Purge modules</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cleanup.purge.wizard.module</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_module" />
<field name="code">
wizard_id = self.create(cr, uid, {}, context=context)
action = {
'type': 'ir.actions.act_window',
'views': [(False, 'form')],
'res_model': 'cleanup.purge.wizard.module',
'res_id': wizard_id,
'flags': {
'action_buttons': False,
'sidebar': False,
},
}
</field>
</record>

</data>
Expand Down
22 changes: 17 additions & 5 deletions database_cleanup/view/purge_tables.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,24 @@
</field>
</record>

<record id="action_purge_tables" model="ir.actions.act_window">
<record id="action_purge_tables" model="ir.actions.server">
<field name="name">Purge tables</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cleanup.purge.wizard.table</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_table" />
<field name="code">
wizard_id = self.create(cr, uid, {}, context=context)
action = {
'type': 'ir.actions.act_window',
'views': [(False, 'form')],
'res_model': 'cleanup.purge.wizard.table',
'res_id': wizard_id,
'flags': {
'action_buttons': False,
'sidebar': False,
},
}
</field>
</record>

</data>
Expand Down

0 comments on commit 678ac7b

Please sign in to comment.