[IMP] ir.module.web (simple web module management)
bzr revid: ame@tinyerp.com-20100112090628-ddwphfzrx340tixm
This commit is contained in:
parent
8ee8ba1251
commit
510d0edff7
|
@ -42,6 +42,7 @@
|
||||||
'ir/workflow/workflow_view.xml',
|
'ir/workflow/workflow_view.xml',
|
||||||
'module/module_wizard.xml',
|
'module/module_wizard.xml',
|
||||||
'module/module_view.xml',
|
'module/module_view.xml',
|
||||||
|
'module/module_web_view.xml',
|
||||||
'module/module_data.xml',
|
'module/module_data.xml',
|
||||||
'module/module_report.xml',
|
'module/module_report.xml',
|
||||||
'res/res_request_view.xml',
|
'res/res_request_view.xml',
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import module
|
import module
|
||||||
|
import module_web
|
||||||
import wizard
|
import wizard
|
||||||
import report
|
import report
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
from osv import fields, osv, orm
|
||||||
|
|
||||||
|
class module_web(osv.osv):
|
||||||
|
_name = "ir.module.web"
|
||||||
|
_description = "Web Module"
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'name': fields.char("Name", size=128, readonly=True, required=True),
|
||||||
|
'description': fields.text("Description", readonly=True, translate=True),
|
||||||
|
'author': fields.char("Author", size=128, readonly=True),
|
||||||
|
'website': fields.char("Website", size=256, readonly=True),
|
||||||
|
'state': fields.selection([
|
||||||
|
('uninstallable','Uninstallable'),
|
||||||
|
('uninstalled','Not Installed'),
|
||||||
|
('installed','Installed')
|
||||||
|
], string='State', readonly=True)
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults = {
|
||||||
|
'state': lambda *a: 'uninstalled',
|
||||||
|
}
|
||||||
|
_order = 'name'
|
||||||
|
|
||||||
|
_sql_constraints = [
|
||||||
|
('name_uniq', 'unique (name)', 'The name of the module must be unique !'),
|
||||||
|
]
|
||||||
|
|
||||||
|
def update_module_list(self, cr, uid, modules, context={}):
|
||||||
|
|
||||||
|
for module in modules:
|
||||||
|
mod_name = module['name']
|
||||||
|
ids = self.search(cr, uid, [('name','=',mod_name)])
|
||||||
|
if ids:
|
||||||
|
self.write(cr, uid, ids, module)
|
||||||
|
else:
|
||||||
|
self.create(cr, uid, module)
|
||||||
|
|
||||||
|
def button_install(self, cr, uid, ids, context={}):
|
||||||
|
return self.write(cr, uid, ids, {'state': 'installed'}, context)
|
||||||
|
|
||||||
|
def button_uninstall(self, cr, uid, ids, context={}):
|
||||||
|
return self.write(cr, uid, ids, {'state': 'uninstalled'}, context)
|
||||||
|
|
||||||
|
module_web()
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="module_web_tree" model="ir.ui.view">
|
||||||
|
<field name="name">ir.module.web.tree</field>
|
||||||
|
<field name="model">ir.module.web</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="description"/>
|
||||||
|
<field name="author"/>
|
||||||
|
<field name="state"/>
|
||||||
|
<button name="button_install" string="Install" type="object" states="uninstalled" context="{'reload': 1}"/>
|
||||||
|
<button name="button_uninstall" string="Uninstall" type="object" states="installed" context="{'reload': 1}"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="open_module_web_list" model="ir.actions.url">
|
||||||
|
<field name="name">web_module_list</field>
|
||||||
|
<field name="url">/modules</field>
|
||||||
|
</record>
|
||||||
|
<menuitem name="Web Modules" action="open_module_web_list" id="open_module_web_list_url" type="url" parent="base.menu_management"/>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
Loading…
Reference in New Issue