bzr revid: nch@tinyerp.com-20090706050445-lqft8tdm4ueqnp6m
This commit is contained in:
Naresh Choksy 2009-07-06 10:34:45 +05:30
commit 2b82c3148c
5 changed files with 25 additions and 5 deletions

View File

@ -377,7 +377,7 @@ class actions_server(osv.osv):
_sequence = 'ir_actions_id_seq'
_order = 'sequence'
_columns = {
'name': fields.char('Action Name', required=True, size=64, help="Easy to Refer action by name e.g. One Sales Order -> Many Invoices"),
'name': fields.char('Action Name', required=True, size=64, help="Easy to Refer action by name e.g. One Sales Order -> Many Invoices", translate=True),
'condition' : fields.char('Condition', size=256, required=True, help="Condition that is to be tested before action is executed, e.g. object.list_price > object.cost_price"),
'state': fields.selection([
('client_action','Client Action'),

View File

@ -94,7 +94,7 @@ class ir_translation(osv.osv):
translations[res_id] = value
return translations
def _set_ids(self, cr, uid, name, tt, lang, ids, value):
def _set_ids(self, cr, uid, name, tt, lang, ids, value, src=None):
# clear the caches
tr = self._get_ids(cr, uid, name, tt, lang, ids)
for res_id in tr:
@ -117,6 +117,7 @@ class ir_translation(osv.osv):
'name':name,
'res_id':id,
'value':value,
'src':src,
})
return len(ids)

View File

@ -433,6 +433,16 @@ class orm_template(object):
return browse_null()
def __export_row(self, cr, uid, row, fields, context=None):
def check_type(type,r):
if type == 'float':
return 0.0
elif type == 'integer':
return 0
elif type == 'char':
return ''
return r
lines = []
data = map(lambda x: '', range(len(fields)))
done = []
@ -444,6 +454,12 @@ class orm_template(object):
while i < len(f):
r = r[f[i]]
if not r:
if f[i] in self._columns:
r = check_type(self._columns[f[i]]._type,r)
elif f[i] in self._inherit_fields:
r = check_type(self._inherit_fields[f[i]][2]._type,r)
data[fpos] = tools.ustr(r)
break
if isinstance(r, (browse_record_list, list)):
first = True
@ -2291,11 +2307,12 @@ class orm(orm_template):
else:
cr.execute('update "'+self._table+'" set '+string.join(upd0, ',')+' ' \
'where id in ('+ids_str+')', upd1)
if totranslate:
for f in direct:
if self._columns[f].translate:
self.pool.get('ir.translation')._set_ids(cr, user, self._name+','+f, 'model', context['lang'], ids, vals[f])
src_trans = self.pool.get(self._name).read(cr,user,ids,[f])
self.pool.get('ir.translation')._set_ids(cr, user, self._name+','+f, 'model', context['lang'], ids, vals[f], src_trans[0][f])
# call the 'set' method of fields which are not classic_write
upd_todo.sort(lambda x, y: self._columns[x].priority-self._columns[y].priority)

View File

@ -573,7 +573,7 @@ class _rml_flowable(object):
from reportlab.graphics.barcode import usps
except Exception, e:
return None
args = utils.attr_get(node, [], {'ratio':'float','xdim':'unit','height':'unit','checksum':'bool','quiet':'bool'})
args = utils.attr_get(node, [], {'ratio':'float','xdim':'unit','height':'unit','checksum':'int','quiet':'int','width':'unit','stop':'bool','bearers':'int','barWidth':'float','barHeight':'float'})
codes = {
'codabar': lambda x: common.Codabar(x, **args),
'code11': lambda x: common.Code11(x, **args),

View File

@ -162,6 +162,8 @@ def attr_get(node, attrs, dict={}):
res[key] = int(node.get(key))
elif dict[key]=='unit':
res[key] = unit_get(node.get(key))
elif dict[key] == 'float' :
res[key] = float(node.get(key))
return res
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: