Browse Source

Merge pull request #158 from hbrunn/8.0-database_cleanup_fixes

[IMP] hide unnecessary buttons in wizard
pull/170/head
Alexandre Fayolle 10 years ago
parent
commit
678ac7be73
  1. 4
      database_cleanup/model/purge_data.py
  2. 1
      database_cleanup/model/purge_wizard.py
  3. 22
      database_cleanup/view/purge_columns.xml
  4. 22
      database_cleanup/view/purge_data.xml
  5. 22
      database_cleanup/view/purge_models.xml
  6. 22
      database_cleanup/view/purge_modules.xml
  7. 22
      database_cleanup/view/purge_tables.xml

4
database_cleanup/model/purge_data.py

@ -82,8 +82,8 @@ class CleanupPurgeWizardData(orm.TransientModel):
SELECT id FROM ir_model_data SELECT id FROM ir_model_data
WHERE model = %%s WHERE model = %%s
AND res_id IS NOT NULL 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,)) """ % self.pool[model]._table, (model,))
data_ids += [data_row[0] for data_row in cr.fetchall()] data_ids += [data_row[0] for data_row in cr.fetchall()]
data_ids += data_pool.search( data_ids += data_pool.search(

1
database_cleanup/model/purge_wizard.py

@ -26,6 +26,7 @@ from openerp.osv import orm, fields
class CleanupPurgeLine(orm.AbstractModel): class CleanupPurgeLine(orm.AbstractModel):
""" Abstract base class for the purge wizard lines """ """ Abstract base class for the purge wizard lines """
_name = 'cleanup.purge.line' _name = 'cleanup.purge.line'
_order = 'name'
_columns = { _columns = {
'name': fields.char('Name', size=256, readonly=True), 'name': fields.char('Name', size=256, readonly=True),
'purged': fields.boolean('Purged', readonly=True), 'purged': fields.boolean('Purged', readonly=True),

22
database_cleanup/view/purge_columns.xml

@ -25,12 +25,24 @@
</field> </field>
</record> </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="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> </record>
</data> </data>

22
database_cleanup/view/purge_data.xml

@ -25,12 +25,24 @@
</field> </field>
</record> </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="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> </record>
</data> </data>

22
database_cleanup/view/purge_models.xml

@ -24,12 +24,24 @@
</field> </field>
</record> </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="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> </record>
</data> </data>

22
database_cleanup/view/purge_modules.xml

@ -24,12 +24,24 @@
</field> </field>
</record> </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="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> </record>
</data> </data>

22
database_cleanup/view/purge_tables.xml

@ -24,12 +24,24 @@
</field> </field>
</record> </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="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> </record>
</data> </data>

Loading…
Cancel
Save