Browse Source

[IMP] allow to select lines to purge in a tree view

pull/469/head
Holger Brunn 9 years ago
parent
commit
aa38f9dbc6
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 9
      database_cleanup/model/purge_wizard.py
  2. 40
      database_cleanup/view/purge_columns.xml
  3. 40
      database_cleanup/view/purge_data.xml
  4. 40
      database_cleanup/view/purge_models.xml
  5. 40
      database_cleanup/view/purge_modules.xml
  6. 31
      database_cleanup/view/purge_tables.xml

9
database_cleanup/model/purge_wizard.py

@ -73,6 +73,15 @@ class PurgeWizard(orm.AbstractModel):
}, },
} }
def select_lines(self, cr, uid, ids, context=None):
return {
'type': 'ir.actions.act_window',
'name': 'Select lines to purge',
'views': [(False, 'tree'), (False, 'form')],
'res_model': self._columns['purge_line_ids']._obj,
'domain': [('wizard_id', 'in', ids)],
}
_columns = { _columns = {
'name': fields.char('Name', size=64, readonly=True), 'name': fields.char('Name', size=64, readonly=True),
} }

40
database_cleanup/view/purge_columns.xml

@ -11,15 +11,20 @@
<field name="name"/> <field name="name"/>
</h1> </h1>
<button type="object" name="purge_all" string="Purge all columns" /> <button type="object" name="purge_all" string="Purge all columns" />
<button type="object" name="select_lines" string="Select lines" />
<field name="purge_line_ids" colspan="4" nolabel="1"> <field name="purge_line_ids" colspan="4" nolabel="1">
<tree string="Purge columns">
<form string="Purge columns">
<group>
<field name="name" /> <field name="name" />
<field name="model_id" /> <field name="model_id" />
<field name="purged" invisible="0" /> <field name="purged" invisible="0" />
</group>
<footer>
<button type="object" name="purge" <button type="object" name="purge"
icon="gtk-cancel" string="Purge this column" icon="gtk-cancel" string="Purge this column"
attrs="{'invisible': [('purged', '=', True)]}"/> attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</footer>
</form>
</field> </field>
</form> </form>
</field> </field>
@ -45,5 +50,36 @@ action = {
</field> </field>
</record> </record>
<record id="purge_column_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.column</field>
<field name="arch" type="xml">
<tree string="Purge columns">
<field name="name" />
<field name="model_id" />
<field name="purged" invisible="0" />
<button type="object" name="purge"
icon="gtk-cancel" string="Purge this column"
attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</field>
</record>
<record id="action_purge_column_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_column" />
<field name="code">
self.purge(cr, uid, context.get('active_ids', []), context)
</field>
</record>
<record id="action_purge_column_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.column</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_column_line')" />
</record>
</data> </data>
</openerp> </openerp>

40
database_cleanup/view/purge_data.xml

@ -11,15 +11,20 @@
<field name="name"/> <field name="name"/>
</h1> </h1>
<button type="object" name="purge_all" string="Purge all data" /> <button type="object" name="purge_all" string="Purge all data" />
<button type="object" name="select_lines" string="Select lines" />
<field name="purge_line_ids" colspan="4" nolabel="1"> <field name="purge_line_ids" colspan="4" nolabel="1">
<tree string="Purge data">
<form string="Purge data">
<group>
<field name="name" /> <field name="name" />
<field name="data_id" /> <field name="data_id" />
<field name="purged" invisible="0" /> <field name="purged" invisible="0" />
</group>
<footer>
<button type="object" name="purge" <button type="object" name="purge"
icon="gtk-cancel" string="Purge this data" icon="gtk-cancel" string="Purge this data"
attrs="{'invisible': [('purged', '=', True)]}"/> attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</footer>
</form>
</field> </field>
</form> </form>
</field> </field>
@ -45,5 +50,36 @@ action = {
</field> </field>
</record> </record>
<record id="purge_data_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.data</field>
<field name="arch" type="xml">
<tree string="Purge data">
<field name="name" />
<field name="data_id" />
<field name="purged" invisible="0" />
<button type="object" name="purge"
icon="gtk-cancel" string="Purge this data"
attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</field>
</record>
<record id="action_purge_data_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_data" />
<field name="code">
self.purge(cr, uid, context.get('active_ids', []), context)
</field>
</record>
<record id="action_purge_data_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.data</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_data_line')" />
</record>
</data> </data>
</openerp> </openerp>

40
database_cleanup/view/purge_models.xml

@ -11,14 +11,19 @@
<field name="name"/> <field name="name"/>
</h1> </h1>
<button type="object" name="purge_all" string="Purge all models" /> <button type="object" name="purge_all" string="Purge all models" />
<button type="object" name="select_lines" string="Select lines" />
<field name="purge_line_ids" colspan="4" nolabel="1"> <field name="purge_line_ids" colspan="4" nolabel="1">
<tree string="Purge models">
<form string="Purge models">
<group>
<field name="name" /> <field name="name" />
<field name="purged" invisible="0" /> <field name="purged" invisible="0" />
</group>
<footer>
<button type="object" name="purge" <button type="object" name="purge"
icon="gtk-cancel" string="Purge this model" icon="gtk-cancel" string="Purge this model"
attrs="{'invisible': [('purged', '=', True)]}"/> attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</footer>
</form>
</field> </field>
</form> </form>
</field> </field>
@ -44,5 +49,36 @@ action = {
</field> </field>
</record> </record>
<record id="purge_model_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.model</field>
<field name="arch" type="xml">
<tree string="Purge models">
<field name="name" />
<field name="purged" invisible="0" />
<button type="object" name="purge"
icon="gtk-cancel" string="Purge this model"
attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</field>
</record>
<record id="action_purge_model_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_model" />
<field name="code">
self.purge(cr, uid, context.get('active_ids', []), context)
</field>
</record>
<record id="action_purge_model_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.model</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_model_line')" />
</record>
</data> </data>
</openerp> </openerp>

40
database_cleanup/view/purge_modules.xml

@ -11,14 +11,19 @@
<field name="name"/> <field name="name"/>
</h1> </h1>
<button type="object" name="purge_all" string="Purge all modules" /> <button type="object" name="purge_all" string="Purge all modules" />
<button type="object" name="select_lines" string="Select lines" />
<field name="purge_line_ids" colspan="4" nolabel="1"> <field name="purge_line_ids" colspan="4" nolabel="1">
<tree string="Purge modules">
<form string="Purge modules">
<group>
<field name="name" /> <field name="name" />
<field name="purged" invisible="0" /> <field name="purged" invisible="0" />
</group>
<footer>
<button type="object" name="purge" <button type="object" name="purge"
icon="gtk-cancel" string="Purge this module" icon="gtk-cancel" string="Purge this module"
attrs="{'invisible': [('purged', '=', True)]}"/> attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</footer>
</form>
</field> </field>
</form> </form>
</field> </field>
@ -44,5 +49,36 @@ action = {
</field> </field>
</record> </record>
<record id="purge_module_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.module</field>
<field name="arch" type="xml">
<tree string="Purge modules">
<field name="name" />
<field name="purged" invisible="0" />
<button type="object" name="purge"
icon="gtk-cancel" string="Purge this module"
attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</field>
</record>
<record id="action_purge_module_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_module" />
<field name="code">
self.purge(cr, uid, context.get('active_ids', []), context)
</field>
</record>
<record id="action_purge_module_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.module</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_module_line')" />
</record>
</data> </data>
</openerp> </openerp>

31
database_cleanup/view/purge_tables.xml

@ -11,6 +11,7 @@
<field name="name"/> <field name="name"/>
</h1> </h1>
<button type="object" name="purge_all" string="Purge all tables" /> <button type="object" name="purge_all" string="Purge all tables" />
<button type="object" name="select_lines" string="Select lines" />
<field name="purge_line_ids" colspan="4" nolabel="1"> <field name="purge_line_ids" colspan="4" nolabel="1">
<tree string="Purge tables"> <tree string="Purge tables">
<field name="name" /> <field name="name" />
@ -44,5 +45,35 @@ action = {
</field> </field>
</record> </record>
<record id="purge_table_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.table</field>
<field name="arch" type="xml">
<tree string="Purge tables">
<field name="name" />
<field name="purged" invisible="0" />
<button type="object" name="purge"
icon="gtk-cancel" string="Purge this table"
attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</field>
</record>
<record id="action_purge_table_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_table" />
<field name="code">
self.purge(cr, uid, context.get('active_ids', []), context)
</field>
</record>
<record id="action_purge_table_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.table</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_table_line')" />
</record>
</data> </data>
</openerp> </openerp>
Loading…
Cancel
Save