fix res_group rename, move files to clean up res
bzr revid: al@openerp.com-20131006150309-fg8vuvaq9hmvi9oh
This commit is contained in:
parent
6488849191
commit
6e2e77beec
|
@ -57,8 +57,8 @@ The kernel of OpenERP, needed for all installation.
|
|||
'ir/ir_ui_view_view.xml',
|
||||
'ir/ir_values_view.xml',
|
||||
'ir/osv_memory_autovacuum.xml',
|
||||
'ir/report/ir_report.xml',
|
||||
'ir/workflow/workflow_view.xml',
|
||||
'ir/ir_model_report.xml',
|
||||
'ir/workflow_view.xml',
|
||||
'module/module_view.xml',
|
||||
'module/module_data.xml',
|
||||
'module/module_report.xml',
|
||||
|
|
|
@ -33,6 +33,7 @@ import ir_values
|
|||
import ir_translation
|
||||
import ir_exports
|
||||
import workflow
|
||||
import workflow_report
|
||||
import ir_rule
|
||||
import wizard
|
||||
import ir_config_parameter
|
||||
|
|
|
@ -1136,4 +1136,32 @@ class ir_model_data(osv.osv):
|
|||
_logger.info('Deleting %s@%s', res_id, model)
|
||||
self.pool[model].unlink(cr, uid, [res_id])
|
||||
|
||||
class wizard_model_menu(osv.osv_memory):
|
||||
_name = 'wizard.ir.model.menu.create'
|
||||
_columns = {
|
||||
'menu_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
|
||||
'name': fields.char('Menu Name', size=64, required=True),
|
||||
}
|
||||
|
||||
def menu_create(self, cr, uid, ids, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
model_pool = self.pool.get('ir.model')
|
||||
for menu in self.browse(cr, uid, ids, context):
|
||||
model = model_pool.browse(cr, uid, context.get('model_id'), context=context)
|
||||
val = {
|
||||
'name': menu.name,
|
||||
'res_model': model.model,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form'
|
||||
}
|
||||
action_id = self.pool.get('ir.actions.act_window').create(cr, uid, val)
|
||||
self.pool.get('ir.ui.menu').create(cr, uid, {
|
||||
'name': menu.name,
|
||||
'parent_id': menu.menu_id.id,
|
||||
'action': 'ir.actions.act_window,%d' % (action_id,),
|
||||
'icon': 'STOCK_INDENT'
|
||||
}, context)
|
||||
return {'type':'ir.actions.act_window_close'}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
model="ir.model"
|
||||
name="ir.model.overview"
|
||||
report_type="sxw"
|
||||
file="base/ir/report/modeloverview.sxw"
|
||||
file="base/ir/ir_model_report.sxw"
|
||||
header="False"
|
||||
/>
|
||||
|
|
@ -1,6 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- menu_create from model form -->
|
||||
<record id="view_model_menu_create" model="ir.ui.view">
|
||||
<field name="name">Create Menu</field>
|
||||
<field name="model">wizard.ir.model.menu.create</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Menu" version="7.0">
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="menu_id" domain="[('parent_id','<>',False)]"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="menu_create" string="Create _Menu" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<act_window context="{'model_id': active_id}" id="act_menu_create" name="Create Menu" res_model="wizard.ir.model.menu.create" target="new" view_mode="form"/>
|
||||
|
||||
<!-- model -->
|
||||
<record id="view_model_form" model="ir.ui.view">
|
||||
<field name="model">ir.model</field>
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import wizard_menu
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
class wizard_model_menu(osv.osv_memory):
|
||||
_name = 'wizard.ir.model.menu.create'
|
||||
_columns = {
|
||||
'menu_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
|
||||
'name': fields.char('Menu Name', size=64, required=True),
|
||||
}
|
||||
|
||||
def menu_create(self, cr, uid, ids, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
model_pool = self.pool.get('ir.model')
|
||||
for menu in self.browse(cr, uid, ids, context):
|
||||
model = model_pool.browse(cr, uid, context.get('model_id'), context=context)
|
||||
val = {
|
||||
'name': menu.name,
|
||||
'res_model': model.model,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form'
|
||||
}
|
||||
action_id = self.pool.get('ir.actions.act_window').create(cr, uid, val)
|
||||
self.pool.get('ir.ui.menu').create(cr, uid, {
|
||||
'name': menu.name,
|
||||
'parent_id': menu.menu_id.id,
|
||||
'action': 'ir.actions.act_window,%d' % (action_id,),
|
||||
'icon': 'STOCK_INDENT'
|
||||
}, context)
|
||||
return {'type':'ir.actions.act_window_close'}
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_model_menu_create" model="ir.ui.view">
|
||||
<field name="name">Create Menu</field>
|
||||
<field name="model">wizard.ir.model.menu.create</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Menu" version="7.0">
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="menu_id" domain="[('parent_id','<>',False)]"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="menu_create" string="Create _Menu" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<act_window context="{'model_id': active_id}" id="act_menu_create" name="Create Menu" res_model="wizard.ir.model.menu.create" target="new" view_mode="form"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,25 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import workflow
|
||||
import print_instance
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -85,24 +85,24 @@ class res_groups(osv.osv):
|
|||
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||
# add explicit ordering if search is sorted on full_name
|
||||
if order and order.startswith('full_name'):
|
||||
ids = super(groups, self).search(cr, uid, args, context=context)
|
||||
ids = super(res_groups, self).search(cr, uid, args, context=context)
|
||||
gs = self.browse(cr, uid, ids, context)
|
||||
gs.sort(key=lambda g: g.full_name, reverse=order.endswith('DESC'))
|
||||
gs = gs[offset:offset+limit] if limit else gs[offset:]
|
||||
return map(int, gs)
|
||||
return super(groups, self).search(cr, uid, args, offset, limit, order, context, count)
|
||||
return super(res_groups, self).search(cr, uid, args, offset, limit, order, context, count)
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
group_name = self.read(cr, uid, [id], ['name'])[0]['name']
|
||||
default.update({'name': _('%s (copy)')%group_name})
|
||||
return super(groups, self).copy(cr, uid, id, default, context)
|
||||
return super(res_groups, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if 'name' in vals:
|
||||
if vals['name'].startswith('-'):
|
||||
raise osv.except_osv(_('Error'),
|
||||
_('The name of the group can not start with "-"'))
|
||||
res = super(groups, self).write(cr, uid, ids, vals, context=context)
|
||||
res = super(res_groups, self).write(cr, uid, ids, vals, context=context)
|
||||
self.pool['ir.model.access'].call_cache_clearing_methods(cr)
|
||||
return res
|
||||
|
||||
|
|
Loading…
Reference in New Issue