'res/res_security.xml',
'res/res_config.xml',
'data/res.country.state.csv',
- 'ir/wizard/wizard_menu_view.xml',
'ir/ir.xml',
'ir/ir_translation_view.xml',
'ir/ir_filters.xml',
import ir_exports
import workflow
import ir_rule
-import wizard
import ir_config_parameter
import osv_memory_autovacuum
import ir_mail_server
+++ /dev/null
-# -*- 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
-import wizard_screen
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+++ /dev/null
-# -*- 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 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'}
-wizard_model_menu()
-
-class wizard_model_menu_line(osv.osv_memory):
- _name = 'wizard.ir.model.menu.create.line'
- _columns = {
- 'wizard_id': fields.many2one('wizard.ir.model.menu.create','Wizard'),
- 'sequence': fields.integer('Sequence'),
- 'view_type': fields.selection([
- ('tree','Tree'),
- ('form','Form'),
- ('graph','Graph'),
- ('calendar','Calendar'),
- ('gantt','Gantt')],'View Type',required=True),
- 'view_id': fields.many2one('ir.ui.view', 'View'),
- }
- _defaults = {
- 'view_type': lambda self,cr,uid,ctx: 'tree'
- }
-wizard_model_menu_line()
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+++ /dev/null
-<?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>
+++ /dev/null
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (C) 2010 OpenERP s.a. (<http://www.openerp.com>).
-#
-# 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 base64
-import os
-import random
-
-import tools
-from osv import fields,osv
-
-# Simple base class for wizards that wish to use random images on the left
-# side of the form.
-class wizard_screen(osv.osv_memory):
- _name = 'ir.wizard.screen'
-
- def _get_image(self, cr, uid, context=None):
- path = os.path.join('base','res','config_pixmaps','%d.png'%random.randrange(1,4))
- image_file = file_data = tools.file_open(path,'rb')
- try:
- file_data = image_file.read()
- return base64.encodestring(file_data)
- finally:
- image_file.close()
-
- def _get_image_fn(self, cr, uid, ids, name, args, context=None):
- image = self._get_image(cr, uid, context)
- return dict.fromkeys(ids, image) # ok to use .fromkeys() as the image is same for all
-
- _columns = {
- 'config_logo': fields.function(_get_image_fn, string='Image', type='binary'),
- }
-
- _defaults = {
- 'config_logo': _get_image
- }
-wizard_screen()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
_name = "base.language.import"
_description = "Language Import"
- _inherit = "ir.wizard.screen"
-
_columns = {
'name': fields.char('Language Name',size=64 , required=True),
'code': fields.char('Code (eg:en__US)',size=5 , required=True),
fileobj.close()
return {}
-base_language_import()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
""" Install Language"""
_name = "base.language.install"
- _inherit = "ir.wizard.screen"
_description = "Install Language"
-
_columns = {
'lang': fields.selection(tools.scan_languages(),'Language', required=True),
'overwrite': fields.boolean('Overwrite Existing Terms', help="If you check this box, your customized translations will be overwritten and replaced by the official ones."),
'target': 'new',
'res_id': ids and ids[0] or False,
}
-base_language_install()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
""" Import Module """
_name = "base.module.import"
- _inherit = "ir.wizard.screen"
_description = "Import Module"
-
_columns = {
'module_file': fields.binary('Module .ZIP file', required=True),
'state':fields.selection([('init','init'),('done','done')],
'type': 'ir.actions.act_window',
}
-base_module_import()
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
_name = "base.module.update"
_description = "Update Module"
- _inherit = "ir.wizard.screen"
_columns = {
'update': fields.integer('Number of modules updated', readonly=True),
}
return res
-
-base_module_update()
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
from osv import osv, fields
import tools
-import pooler
import cStringIO
from tools.translate import _
class base_update_translations(osv.osv_memory):
def _get_languages(self, cr, uid, context):
- lang_obj=pooler.get_pool(cr.dbname).get('res.lang')
- ids=lang_obj.search(cr, uid, ['&', ('active', '=', True), ('translatable', '=', True),])
- langs=lang_obj.browse(cr, uid, ids)
+ lang_obj = self.pool.get('res.lang')
+ ids = lang_obj.search(cr, uid, ['&', ('active', '=', True), ('translatable', '=', True),])
+ langs = lang_obj.browse(cr, uid, ids)
return [(lang.code, lang.name) for lang in langs]
def _get_lang_name(self, cr, uid, lang_code):
- lang_obj=pooler.get_pool(cr.dbname).get('res.lang')
- ids=lang_obj.search(cr, uid, [('code', '=', lang_code)])
+ lang_obj = self.pool.get('res.lang')
+ ids = lang_obj.search(cr, uid, [('code', '=', lang_code)])
if not ids:
raise osv.except_osv(_('Error!'), _('No language with code "%s" exists') % lang_code)
lang = lang_obj.browse(cr, uid, ids[0])
return lang.name
- def act_cancel(self, cr, uid, ids, context=None):
- return {'type': 'ir.actions.act_window_close'}
def act_update(self, cr, uid, ids, context=None):
this = self.browse(cr, uid, ids)[0]
lang_name = self._get_lang_name(cr, uid, this.lang)
- buf=cStringIO.StringIO()
+ buf = cStringIO.StringIO()
tools.trans_export(this.lang, ['all'], buf, 'csv', cr)
tools.trans_load_data(cr, buf, 'csv', this.lang, lang_name=lang_name)
buf.close()
return res
_name = 'base.update.translations'
- _inherit = "ir.wizard.screen"
_columns = {
'lang': fields.selection(_get_languages, 'Language', required=True),
}
-base_update_translations()
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
<footer>
<button name="act_update" string="Update" type="object" class="oe_highlight"/>
or
- <button name="act_cancel" special="cancel" string="Cancel" type="object" class="oe_link"/>
+ <button special="cancel" string="Cancel" type="object" class="oe_link"/>
</footer>
</form>
</field>
their view inherit from the related res_config_view_base view.
'''
_name = 'res.config'
- _inherit = 'ir.wizard.screen'
def _next_action(self, cr, uid, context=None):
Todos = self.pool['ir.actions.todo']