merge with last trunk
bzr revid: jean-baptiste.aubort@camptocamp.com-20080829151320-orgj8ockj329w9a2
This commit is contained in:
commit
aa54bd8eeb
File diff suppressed because it is too large
Load Diff
|
@ -1195,7 +1195,8 @@ Cron Jobs
|
|||
|
||||
<page string="Create / Write" attrs="{'invisible':[('state','=','python'),('state','=','dummy'),('state','=','trigger'), ('state','=','sms'), ('state','=','email'), ('state','=','client_action'), ('state','=','other')]}">
|
||||
<separator colspan="4" string="Fields Mapping"/>
|
||||
<field name="srcmodel_id" select="2"/>
|
||||
<field name="otype"/>
|
||||
<field name="srcmodel_id" select="2" attrs="{'readonly':[('type','!=','new'),('type','!=','object_create')]}"/>
|
||||
<field name="fields_lines" nolabel="1" select="2" colspan="4">
|
||||
<tree string="Field Mappings" editable="top">
|
||||
<field name="col1" domain="[('model_id','=',parent.srcmodel_id)]"/>
|
||||
|
@ -1205,7 +1206,7 @@ Cron Jobs
|
|||
<form string="Field Mapping">
|
||||
<field name="col1" domain="[('model_id','=',parent.srcmodel_id)]"/>
|
||||
<field name="type"/>
|
||||
<field name="value" colapsn="4"/>
|
||||
<field name="value" colsapan="4"/>
|
||||
</form>
|
||||
</field>
|
||||
</page>
|
||||
|
|
|
@ -380,8 +380,12 @@ class actions_server(osv.osv):
|
|||
'child_ids': fields.one2many('ir.actions.actions', 'parent_id', 'Others Actions'),
|
||||
'usage': fields.char('Action Usage', size=32),
|
||||
'type': fields.char('Report Type', size=32, required=True),
|
||||
'srcmodel_id': fields.many2one('ir.model', 'Model', required=True),
|
||||
'srcmodel_id': fields.many2one('ir.model', 'Model'),
|
||||
'fields_lines': fields.one2many('ir.server.object.lines', 'server_id', 'Fields Mapping'),
|
||||
'otype': fields.selection([
|
||||
('copy','Create in Same Model'),
|
||||
('new','Create in Other Model')
|
||||
], 'Create Model', required=True, size=32, change_default=True),
|
||||
}
|
||||
_defaults = {
|
||||
'state': lambda *a: 'dummy',
|
||||
|
@ -522,7 +526,18 @@ class actions_server(osv.osv):
|
|||
obj_pool.write(cr, uid, [context.get('active_id')], res)
|
||||
|
||||
if action.state == 'object_create':
|
||||
pass
|
||||
res = {}
|
||||
for exp in action.fields_lines:
|
||||
euq = exp.value
|
||||
if exp.type == 'equation':
|
||||
expr = self.merge_message(cr, uid, euq, action, context)
|
||||
expr = eval(expr)
|
||||
else:
|
||||
expr = exp.value
|
||||
res[exp.col1.name] = expr
|
||||
obj_pool = self.pool.get(action.model_id.model)
|
||||
id = context.get('active_id')
|
||||
obj_pool.copy(cr, uid, id, res)
|
||||
|
||||
return False
|
||||
actions_server()
|
||||
|
|
|
@ -461,14 +461,14 @@ class module(osv.osv):
|
|||
match = re.search('-([a-zA-Z0-9\._-]+)(\.zip)', mod.url, re.I)
|
||||
version = '0'
|
||||
if match:
|
||||
version = match.group(1)
|
||||
version = match.group(1)
|
||||
if vercmp(mod.installed_version or '0', version) >= 0:
|
||||
continue
|
||||
res.append(mod.url)
|
||||
if not download:
|
||||
continue
|
||||
zipfile = urllib.urlopen(mod.url).read()
|
||||
fname = addons.get_module_path(mod.name+'.zip')
|
||||
fname = addons.get_module_path(mod.name+'.zip')
|
||||
try:
|
||||
fp = file(fname, 'wb')
|
||||
fp.write(zipfile)
|
||||
|
@ -516,6 +516,15 @@ class module(osv.osv):
|
|||
p_id = c_id
|
||||
categs = categs[1:]
|
||||
self.write(cr, uid, [id], {'category_id': p_id})
|
||||
|
||||
def action_install(self,cr,uid,ids,context=None):
|
||||
self.write(cr , uid, ids ,{'state' : 'to install'})
|
||||
self.download(cr, uid, ids, context=context)
|
||||
for id in ids:
|
||||
cr.execute("select m.id as id from ir_module_module_dependency d inner join ir_module_module m on (m.name=d.name) where d.module_id=%d and m.state='uninstalled'",(id,))
|
||||
dep_ids = map(lambda x:x[0],cr.fetchall())
|
||||
if len(dep_ids):
|
||||
self.action_install(cr,uid,dep_ids,context=context)
|
||||
module()
|
||||
|
||||
class module_dependency(osv.osv):
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
<field name="model">ir.module.module</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="blue:state=='to upgrade' or state=='to install';grey:state=='uninstalled' or state=='uninstallable'" string="Modules">
|
||||
<tree colors="blue:state=='to upgrade' or state=='to install';red:state=='uninstalled';grey:state=='uninstallable'" string="Modules">
|
||||
<field name="name"/>
|
||||
<field name="shortdesc"/>
|
||||
<field name="author"/>
|
||||
|
|
|
@ -122,10 +122,10 @@ def _partner_title_get(self, cr, uid, context={}):
|
|||
|
||||
def _lang_get(self, cr, uid, context={}):
|
||||
obj = self.pool.get('res.lang')
|
||||
ids = obj.search(cr, uid, [])
|
||||
ids = obj.search(cr, uid, [], context=context)
|
||||
res = obj.read(cr, uid, ids, ['code', 'name'], context)
|
||||
res = [(r['code'], r['name']) for r in res]
|
||||
return res + [(False, '')]
|
||||
return [(r['code'], r['name']) for r in res]
|
||||
|
||||
|
||||
class res_partner(osv.osv):
|
||||
_description='Partner'
|
||||
|
|
|
@ -203,11 +203,11 @@
|
|||
<form string="Partners">
|
||||
<group colspan="4" col="6">
|
||||
<field name="name" select="1"/>
|
||||
<field name="customer" select="1"/>
|
||||
<field name="supplier" select="2"/>
|
||||
<field domain="[('domain', '=', 'partner')]" name="title"/>
|
||||
<field name="ref" select="1"/>
|
||||
<field name="customer" select="1"/>
|
||||
<field domain="[('domain', '=', 'partner')]" name="title"/>
|
||||
<field name="lang" select="2"/>
|
||||
<field name="supplier" select="2"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="General">
|
||||
|
@ -249,6 +249,7 @@
|
|||
<field name="website" widget="url"/>
|
||||
<field name="date" select="2"/>
|
||||
<field name="parent_id"/>
|
||||
<newline/>
|
||||
</page>
|
||||
<page string="History">
|
||||
<field colspan="4" name="events" nolabel="1" widget="one2many_list"/>
|
||||
|
@ -279,7 +280,11 @@
|
|||
<field name="view_id" ref="view_partner_form"/>
|
||||
<field name="act_window_id" ref="action_partner_form"/>
|
||||
</record>
|
||||
<menuitem action="action_partner_form" id="menu_partner_form" parent="base.menu_base_partner"/>
|
||||
<menuitem
|
||||
action="action_partner_form"
|
||||
id="menu_partner_form"
|
||||
parent="base.menu_base_partner"
|
||||
sequence="2"/>
|
||||
|
||||
<record id="action_partner_customer_form" model="ir.actions.act_window">
|
||||
<field name="name">Customers Partners</field>
|
||||
|
@ -469,8 +474,8 @@
|
|||
<field name="view_id" ref="view_partner_category_tree"/>
|
||||
<field name="domain">[('parent_id','=',False)]</field>
|
||||
</record>
|
||||
<menuitem id="next_id_13" name="Categories" parent="base.menu_base_config"/><menuitem action="action_partner_category" id="menu_partner_category" parent="next_id_13"/>
|
||||
|
||||
<menuitem action="action_partner_category" id="menu_partner_category_main" parent="base.menu_base_partner" sequence="1"/>
|
||||
|
||||
<record id="action_partner_by_category" model="ir.actions.act_window">
|
||||
<field name="name" eval="False"/>
|
||||
<field name="res_model">res.partner</field>
|
||||
|
@ -486,19 +491,14 @@
|
|||
<field eval="'ir.actions.act_window,%d'%action_partner_by_category" name="value"/>
|
||||
<field eval="True" name="object"/>
|
||||
</record>
|
||||
|
||||
|
||||
<menuitem action="action_partner_category" id="menu_partner_category_main" parent="base.menu_base_partner" sequence="1"/>
|
||||
|
||||
|
||||
<record id="action_partner_category_form" model="ir.actions.act_window">
|
||||
<field name="name">Partner categories</field>
|
||||
<field name="name">Partner Categories</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.partner.category</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem action="action_partner_category_form" id="menu_partner_category_form" parent="base.next_id_13"/>
|
||||
|
||||
|
||||
|
||||
<menuitem action="action_partner_category_form" id="menu_partner_category_form" parent="base.menu_base_config"/>
|
||||
|
||||
</data>
|
||||
</terp>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Currency">
|
||||
<field colspan="4" name="name" select="1"/>
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="rate"/>
|
||||
<field name="rounding"/>
|
||||
|
|
|
@ -203,6 +203,8 @@ class expression(object):
|
|||
return self
|
||||
|
||||
def __leaf_to_sql(self, leaf, table):
|
||||
if leaf == self.__DUMMY_LEAF:
|
||||
return ('(1=1)',[])
|
||||
left, operator, right = leaf
|
||||
|
||||
if operator == 'inselect':
|
||||
|
|
|
@ -639,16 +639,17 @@ class orm_template(object):
|
|||
context = context or {}
|
||||
lng = context.get('lang', False) or 'en_US'
|
||||
trans = self.pool.get('ir.translation')
|
||||
field_error = []
|
||||
field_err_str = []
|
||||
error_msgs = []
|
||||
for constraint in self._constraints:
|
||||
fun, msg, fields = constraint
|
||||
if not fun(self, cr, uid, ids):
|
||||
field_error += fields
|
||||
field_err_str.append(trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg)
|
||||
if len(field_err_str):
|
||||
translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg
|
||||
error_msgs.append(
|
||||
_("Error occur when validation the fields %s: %s") % (','.join(fields), translated_msg)
|
||||
)
|
||||
if error_msgs:
|
||||
cr.rollback()
|
||||
raise except_orm('ValidateError', ('\n'.join(field_err_str), ','.join(field_error)))
|
||||
raise except_orm('ValidateError', '\n'.join(error_msgs))
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
return {}
|
||||
|
@ -1120,9 +1121,11 @@ class orm_memory(orm_template):
|
|||
for id in ids:
|
||||
r = {'id': id}
|
||||
for f in fields:
|
||||
r[f] = self.datas[id].get(f, False)
|
||||
if id in self.datas:
|
||||
r[f] = self.datas[id].get(f, False)
|
||||
result.append(r)
|
||||
self.datas[id]['internal.date_access'] = time.time()
|
||||
if id in self.datas:
|
||||
self.datas[id]['internal.date_access'] = time.time()
|
||||
fields_post = filter(lambda x: x in self._columns and not getattr(self._columns[x], load), fields)
|
||||
for f in fields_post:
|
||||
res2 = self._columns[f].get_memory(cr, self, ids, f, user, context=context, values=False)
|
||||
|
@ -1193,7 +1196,7 @@ class orm_memory(orm_template):
|
|||
res = ir_values_obj.get(cr, uid, 'default', False, [self._name])
|
||||
for id, field, field_value in res:
|
||||
if field in fields_list:
|
||||
fld_def = (field in self._columns)
|
||||
fld_def = (field in self._columns) and self._columns[field] or self._inherit_fields[field][2]
|
||||
if fld_def._type in ('many2one', 'one2one'):
|
||||
obj = self.pool.get(fld_def._obj)
|
||||
if not obj.search(cr, uid, [('id', '=', field_value)]):
|
||||
|
|
|
@ -32,8 +32,8 @@ import re
|
|||
|
||||
# First a little helper, since I don't like to repeat things. (Tismer speaking)
|
||||
import string
|
||||
def replace(where, what, with):
|
||||
return string.join(string.split(where, what), with)
|
||||
def replace(where, what, with_whom):
|
||||
return string.join(string.split(where, what), with_whom)
|
||||
|
||||
# This list of keywords is taken from ref/node13.html of the
|
||||
# Python 1.3 HTML documentation. ("access" is intentionally omitted.)
|
||||
|
|
Loading…
Reference in New Issue