summaryrefslogtreecommitdiff
path: root/bin/addons/base
diff options
context:
space:
mode:
authorOlivier Laurent <olt@tinyerp.com>2008-12-15 17:25:07 +0100
committerOlivier Laurent <olt@tinyerp.com>2008-12-15 17:25:07 +0100
commit8deaf883c75ff71e3bee3a871df89f12dafb87b2 (patch)
treee26af93546384b88297639526063fbdf391632f7 /bin/addons/base
parent9f9f2ff78e08cd826f09f3f7dab0a80723112bbf (diff)
parentbe2a0a76bbd95ce83cc68a10ce25e5b60279a0e6 (diff)
merge
bzr revid: olt@tinyerp.com-20081215162507-8oox01yssbfbbetf
Diffstat (limited to 'bin/addons/base')
-rw-r--r--bin/addons/base/ir/ir.xml12
-rw-r--r--bin/addons/base/ir/ir_actions.py39
-rw-r--r--bin/addons/base/module/module.py43
3 files changed, 29 insertions, 65 deletions
diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml
index 263f5428718..c649b12cf99 100644
--- a/bin/addons/base/ir/ir.xml
+++ b/bin/addons/base/ir/ir.xml
@@ -1142,13 +1142,7 @@
<field name="model_id" select="1"/>
<field name="sequence" select="2"/>
<notebook colspan="4">
- <!--<page string="Python Code" attrs="{'invisible':[('state','!=','python')]}">
- <separator colspan="4" string="Python code"/>
- <field name="code" colspan="4" nolabel="1" />
- <button string="Create Action" name="%(wizard_server_action_create)d" type="action"/>
- </page>
-
- --><page string="Trigger" attrs="{'invisible':[('state','!=','trigger')]}">
+ <page string="Trigger" attrs="{'invisible':[('state','!=','trigger')]}">
<separator colspan="4" string="Trigger Configuration"/>
<field name="wkf_model_id"/>
<field name="trigger_obj_id" select="2" domain="[('model_id','=',model_id)]" on_change="on_trigger_obj_id(trigger_obj_id)"/>
@@ -1197,7 +1191,8 @@
<page string="Multi Actions" attrs="{'invisible':[('state','!=','other')]}">
<separator colspan="4" string="Other Actions Configuration"/>
<field name="child_ids" nolabel="1" colspan="4"/>
- <label colspan="4" string="Only one client action will be execute, last clinent action will be consider in case of multipls clinets actions" align="0.0"/>
+ <label colspan="4" string="Only one client action will be execute, last
+ clinent action will be consider in case of multiples clients actions" align="0.0"/>
</page>
</notebook>
@@ -1223,6 +1218,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.actions.server</field>
<field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
<field name="view_id" ref="view_server_action_tree"/>
<field name="context">{'key':'server_action'}</field>
</record>
diff --git a/bin/addons/base/ir/ir_actions.py b/bin/addons/base/ir/ir_actions.py
index d31a13211a5..c270557f6c5 100644
--- a/bin/addons/base/ir/ir_actions.py
+++ b/bin/addons/base/ir/ir_actions.py
@@ -365,21 +365,22 @@ server_object_lines()
#
class actions_server(osv.osv):
+ def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False):
+ res = super(actions_server, self).fields_view_get(cr, user, view_id, view_type, context, toolbar)
+ #print 'RES : ',res
+ return res
+
def _select_signals(self, cr, uid, context={}):
cr.execute("select distinct t.signal as key, t.signal || ' - [ ' || w.osv || ' ] ' as val from wkf w, wkf_activity a, wkf_transition t "\
" where w.id = a.wkf_id " \
" and t.act_from = a.wkf_id " \
- " or t.act_to = a.wkf_id ")
- return cr.fetchall()
-
- def on_trigger_obj_id(self, cr, uid, ids, context={}):
- cr.execute("select distinct t.signal as key, t.signal as val from wkf w, wkf_activity a, wkf_transition t "\
- " where w.id = a.wkf_id " \
- " and t.act_from = a.wkf_id " \
- " or t.act_to = a.wkf_id " \
- " and w.osv = %s ", ('account.invoice'))
- data = cr.fetchall()
- return {"values":{'trigger_name':data}}
+ " or t.act_to = a.wkf_id and t.signal not in (null, NULL)")
+ result = cr.fetchall() or []
+ res = []
+ for rs in result:
+ if not rs[0] == None and not rs[1] == None:
+ res.append(rs)
+ return res
_name = 'ir.actions.server'
_table = 'ir_act_server'
@@ -396,7 +397,6 @@ class actions_server(osv.osv):
('object_write','Write Object'),
('other','Multi Actions'),
], 'Action State', required=True, size=32),
- 'code': fields.text('Python Code'),
'sequence': fields.integer('Sequence'),
'model_id': fields.many2one('ir.model', 'Object', required=True),
'action_id': fields.many2one('ir.actions.actions', 'Client Action'),
@@ -417,16 +417,7 @@ class actions_server(osv.osv):
_defaults = {
'state': lambda *a: 'dummy',
'type': lambda *a: 'ir.actions.server',
- 'sequence': lambda *a: 0,
- 'code': lambda *a: """# You can use the following variables
-# - object
-# - object2
-# - time
-# - cr
-# - uid
-# - ids
-# If you plan to return an action, assign: action = {...}
-""",
+ 'sequence': lambda *a: 5,
}
@@ -568,7 +559,7 @@ class actions_server(osv.osv):
if exp.type == 'equation':
obj_pool = self.pool.get(action.model_id.model)
obj = obj_pool.browse(cr, uid, context['active_id'], context=context)
- expr = eval(euq, {'context':context, 'object': obj})
+ expr = eval(euq, {'context':context, 'object': obj, 'time':time})
else:
expr = exp.value
res[exp.col1.name] = expr
@@ -592,7 +583,7 @@ class actions_server(osv.osv):
if exp.type == 'equation':
obj_pool = self.pool.get(action.model_id.model)
obj = obj_pool.browse(cr, uid, context['active_id'], context=context)
- expr = eval(euq, {'context':context, 'object': obj})
+ expr = eval(euq, {'context':context, 'object': obj, 'time':time})
else:
expr = exp.value
res[exp.col1.name] = expr
diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py
index 439cf5b57a6..376e80450f9 100644
--- a/bin/addons/base/module/module.py
+++ b/bin/addons/base/module/module.py
@@ -292,10 +292,7 @@ class module(osv.osv):
res = [0, 0] # [update, add]
# iterate through installed modules and mark them as being so
- for name in addons.get_modules():
- mod_name = name
- if name[-4:]=='.zip':
- mod_name=name[:-4]
+ for mod_name in addons.get_modules():
ids = self.search(cr, uid, [('name','=',mod_name)])
if ids:
id = ids[0]
@@ -304,8 +301,7 @@ class module(osv.osv):
if terp.get('installable', True) and mod.state == 'uninstallable':
self.write(cr, uid, id, {'state': 'uninstalled'})
if parse_version(terp.get('version', '')) > parse_version(mod.latest_version or ''):
- self.write(cr, uid, id, {
- 'url': ''})
+ self.write(cr, uid, id, { 'url': ''})
res[0] += 1
self.write(cr, uid, id, {
'description': terp.get('description', ''),
@@ -314,28 +310,16 @@ class module(osv.osv):
'website': terp.get('website', ''),
'license': terp.get('license', 'GPL-2'),
})
- cr.execute('DELETE FROM ir_module_module_dependency\
- WHERE module_id = %s', (id,))
- self._update_dependencies(cr, uid, ids[0], terp.get('depends',
- []))
- self._update_category(cr, uid, ids[0], terp.get('category',
- 'Uncategorized'))
+ cr.execute('DELETE FROM ir_module_module_dependency WHERE module_id = %s', (id,))
+ self._update_dependencies(cr, uid, ids[0], terp.get('depends', []))
+ self._update_category(cr, uid, ids[0], terp.get('category', 'Uncategorized'))
continue
- terp_file = addons.get_module_resource(name, '__terp__.py')
- mod_path = addons.get_module_path(name)
- if mod_path and (os.path.isdir(mod_path) or os.path.islink(mod_path) or zipfile.is_zipfile(mod_path)):
+ mod_path = addons.get_module_path(mod_name)
+ if mod_path:
terp = self.get_module_info(mod_name)
if not terp or not terp.get('installable', True):
continue
- #if not os.path.isfile( mod_path ):
- # import imp
- # path = imp.find_module(mod_name, [addons.ad, addons._ad])
- # imp.load_module(name, *path)
- #else:
- # import zipimport
- # zimp = zipimport.zipimporter(mod_path)
- # zimp.load_module(mod_name)
id = self.create(cr, uid, {
'name': mod_name,
'state': 'uninstalled',
@@ -349,8 +333,6 @@ class module(osv.osv):
self._update_dependencies(cr, uid, id, terp.get('depends', []))
self._update_category(cr, uid, id, terp.get('category', 'Uncategorized'))
- #import socket
- #socket.setdefaulttimeout(10)
for repository in robj.browse(cr, uid, robj.search(cr, uid, [])):
try:
index_page = urllib.urlopen(repository.url).read()
@@ -363,9 +345,7 @@ class module(osv.osv):
modules = re.findall(repository.filter, index_page, re.I+re.M)
mod_sort = {}
for m in modules:
- name = m[0]
- version = m[1]
- extension = m[-1]
+ name, version, extension = m[0], m[1], m[-1]
if version == 'x': # 'x' version was a mistake
version = '0'
if name in mod_sort:
@@ -390,16 +370,13 @@ class module(osv.osv):
if installed_version == 'x': # 'x' version was a mistake
installed_version = '0'
if parse_version(version) > parse_version(installed_version):
- self.write(cr, uid, id, {
- 'url': url
- })
+ self.write(cr, uid, id, { 'url': url })
res[0] += 1
published_version = self.read(cr, uid, id, ['published_version'])['published_version']
if published_version == 'x' or not published_version:
published_version = '0'
if parse_version(version) > parse_version(published_version):
- self.write(cr, uid, id,
- {'published_version': version})
+ self.write(cr, uid, id, {'published_version': version})
return res
def download(self, cr, uid, ids, download=True, context=None):