Browse Source

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

[IMP] adaptto upstream changes
pull/1009/head
Holger Brunn 10 years ago
parent
commit
20377bd2f8
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 9
      database_cleanup/model/purge_wizard.py
  2. 50
      database_cleanup/view/purge_columns.xml
  3. 50
      database_cleanup/view/purge_data.xml
  4. 42
      database_cleanup/view/purge_menus.xml
  5. 50
      database_cleanup/view/purge_models.xml
  6. 50
      database_cleanup/view/purge_modules.xml
  7. 41
      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),
} }

50
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>
@ -30,20 +35,37 @@
<field name="type">ir.actions.server</field> <field name="type">ir.actions.server</field>
<field name="state">code</field> <field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_column" /> <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 name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</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> </field>
</record> </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>

50
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>
@ -30,20 +35,37 @@
<field name="type">ir.actions.server</field> <field name="type">ir.actions.server</field>
<field name="state">code</field> <field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_data" /> <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 name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</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> </field>
</record> </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>

42
database_cleanup/view/purge_menus.xml

@ -10,18 +10,24 @@
<field name="name"/> <field name="name"/>
</h1> </h1>
<button type="object" name="purge_all" string="Purge all menus" /> <button type="object" name="purge_all" string="Purge all menus" />
<button type="object" name="select_lines" string="Select lines" />
<field name="purge_line_ids"> <field name="purge_line_ids">
<tree>
<form>
<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 menu"
attrs="{'invisible': [('purged', '=', True)]}"/> attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</footer>
</form>
</field> </field>
</form> </form>
</field> </field>
</record> </record>
<record id="action_purge_menus" model="ir.actions.server"> <record id="action_purge_menus" model="ir.actions.server">
<field name="name">Purge menus</field> <field name="name">Purge menus</field>
<field name="type">ir.actions.server</field> <field name="type">ir.actions.server</field>
@ -29,5 +35,35 @@
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_menu" /> <field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_menu" />
<field name="code">action = self.get_wizard_action(cr, uid, context=context)</field> <field name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</record> </record>
<record id="purge_menu_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.menu</field>
<field name="arch" type="xml">
<tree>
<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_menu_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_menu" />
<field name="code">self.purge(cr, uid, context.get('active_ids', []), context)</field>
</record>
<record id="action_purge_menu_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.menu</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_menu_line')" />
</record>
</data> </data>
</openerp> </openerp>

50
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>
@ -29,20 +34,37 @@
<field name="type">ir.actions.server</field> <field name="type">ir.actions.server</field>
<field name="state">code</field> <field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_model" /> <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 name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</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> </field>
</record> </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>

50
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>
@ -29,20 +34,37 @@
<field name="type">ir.actions.server</field> <field name="type">ir.actions.server</field>
<field name="state">code</field> <field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_module" /> <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 name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</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> </field>
</record> </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>

41
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" />
@ -29,20 +30,36 @@
<field name="type">ir.actions.server</field> <field name="type">ir.actions.server</field>
<field name="state">code</field> <field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_table" /> <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 name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</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> </field>
</record> </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