我在openERP-7中创建了序列号。像这样'cus': time.strftime('%y', t),
。这是,
def _interpolation_dict(self):
t = time.localtime() # Actually, the server is always in UTC.
return {
'year': time.strftime('%Y', t),
# custom method
'cus': time.strftime('%y', t),
'month': time.strftime('%m', t),
'day': time.strftime('%d', t),
'y': time.strftime('%y', t),
'doy': time.strftime('%j', t),
'woy': time.strftime('%W', t),
'weekday': time.strftime('%w', t),
'h24': time.strftime('%H', t),
'h12': time.strftime('%I', t),
'min': time.strftime('%M', t),
'sec': time.strftime('%S', t),
}
这是我选择了我的序列号
但我收到了错误,
result = _execute(cr, workitem, activity, ident, stack)
File "/opt/openerp_hr/server/openerp/workflow/workitem.py", line 106, in _execute
returned_action = wkf_expr.execute(cr, ident, workitem, activity)
File "/opt/openerp_hr/server/openerp/workflow/wkf_expr.py", line 67, in execute
return _eval_expr(cr, ident, workitem, activity['action'])
File "/opt/openerp_hr/server/openerp/workflow/wkf_expr.py", line 57, in _eval_expr
ret = eval(line, env, nocopy=True)
File "/opt/openerp_hr/server/openerp/tools/safe_eval.py", line 241, in safe_eval
return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
File "", line 1, in <module>
File "/opt/openerp_hr/server/openerp/osv/orm.py", line 374, in function_proxy
return attr(self._cr, self._uid, [self._id], *args, **kwargs)
File "/opt/openerp_hr/addons/account/account_invoice.py", line 1050, in action_move_create
move_obj.post(cr, uid, [move_id], context=ctx)
File "/opt/openerp_hr/addons/account/account.py", line 1347, in post
new_name = obj_sequence.next_by_id(cr, uid, journal.sequence_id.id, c)
File "/opt/openerp_hr/addons/base/ir/ir_sequence.py", line 267, in next_by_id
return self._next(cr, uid, ids, context)
File "/opt/openerp_hr/addons/account/ir_sequence.py", line 57, in _next
return super(ir_sequence, self)._next(cr, uid, seq_ids, context)
File "/opt/openerp_hr/addons/base/ir/ir_sequence.py", line 256, in _next
interpolated_prefix = self._interpolate(seq['prefix'], d)
File "/opt/openerp_hr/addons/base/ir/ir_sequence.py", line 218, in _interpolate
return s % d
KeyError: u'cus'
答案 0 :(得分:1)
我发现了您的错误日志,您只在/opt/openerp_hr/addons/base/ir/ir_sequence.py
添加了自定义属性。您需要添加自定义属性
/opt/openerp_hr/server/openerp/addons/base/ir/ir_sequence.py
。
注意:我不知道服务器路径,它从env变为env。
我希望这会对你有所帮助。