oe版本:7.0-20130701
起初是发现报价单打印时报500错误,控制台报错File "/Library/Python/2.7/site-packages/Werkzeug-0.9.2-py2.7.egg/werkzeug/_compat.py", line 106, in to_bytes
raise TypeError('Expected bytes')
TypeError: Expected bytes
各种折腾,最后修改文件openerp\addons\web\controllers\main.py
cookies={'fileToken': int(token)}) 替换为 cookies={'fileToken': token}) 问题解决
不知道是不是bug……
ccloolcc
-
V7打印报错问题的疑问 -
修改发件人(SMTP)服务器为用户个人配置(已增加模块地址)[quote author=ccdos link=topic=7412.msg16950#msg16950 date=1373476516]<br / https://github.com/ccdos/into-openerp-addons/tree/master/auto_select_smtp br />
自动选择合适的 smtp
[/quote]
多谢ccdos的模块,需求上还不太合用,不过学习到了方法重载。 -
修改发件人(SMTP)服务器为用户个人配置(已增加模块地址)2013-07-25 制作成模块 下载地址 https://github.com/ccloolcc/sent-email-by-user-config br />由于还不太明白重载的写法,所以直接拷贝的原方法的所有代码,新手轻喷。
需求:openerp所有外发邮件改用每个用户自行配置的邮箱账户进行发送(smtp服务器是同一台且邮箱域名相同)。
1. 设置——数据结构——字段,创建一个字段模型选择res.user,字段类型为char
2. 设置——用户界面——视图,搜索res.users.preferences.form(由于我只想在首选项里看见这个input,所以只改了这个视图),找喜欢的位置添加代码<field name="刚才创建的字段名" password="1"/>(password="1"这里获得了mrshelly大神的帮助,在此鸣谢)
3. 打开文件addons/base/ir/ir_mail_server.py,在441行后添加代码段如下:
smtp_user = smtp_from #邮箱账户强制改成发件人,有点粗暴。注意,这里的smtp_from是别名,并不是用户看见的那个邮箱。据此推断写成下边这样应该更方便。
#smtp_user = self.pool.get('res.users').browse(cr, uid, uid, context=context).email
smtp_password = self.pool.get('res.users').browse(cr, uid, uid, context=context).刚才创建的字段名
我知道我的方法有些粗暴,后续如果官方有升级的话会很麻烦。所以希望有大神可以指点下这样的模块要怎么开发。我在网上搜了模块开发的教程,不过都是新模块,没有设计到对老模块的修改和补充的模块,所以也比较没头绪
PS:刚才调试了一下获取res.users.email的代码,最终发现email字段根本不存在users表中而是在partner这个表里,所以修改获取smtp_user的代码如下:
pid = self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id._id
smtp_user = self.pool.get('res.partner').browse(cr, uid, pid, context=context).email -
关于打印生成pdf左侧的generated by OpenERP.com的问题呃 受教了 原来这么简单 打一开始就没往这个方向上想 谢谢
-
关于打印生成pdf左侧的generated by OpenERP.com的问题addons/base/res/res_company.py 330行附近
数据库 res_company.rml_header -
7.0点击报价单上的以邮件发送会报错 不是那个字体问题如题,报错内容如下:
OpenERP Server Error
Client Traceback (most recent call last):
File "E:\openerp\openerp\addons\web\http.py", line 195, in dispatch
response["result"] = method(self, **self.params)
File "E:\openerp\openerp\addons\web\controllers\main.py", line 1080, in call_kw
return self._call_kw(req, model, method, args, kwargs)
File "E:\openerp\openerp\addons\web\controllers\main.py", line 1072, in _call_kw
return getattr(req.session.model(model), method)(*args, **kwargs)
File "E:\openerp\openerp\addons\web\session.py", line 43, in proxy
result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
File "E:\openerp\openerp\addons\web\session.py", line 31, in proxy_method
result = self.session.send(self.service_name, method, *args)
File "E:\openerp\openerp\addons\web\session.py", line 104, in send
raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)
Server Traceback (most recent call last):
File "E:\openerp\openerp\addons\web\session.py", line 90, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "E:\openerp\openerp\netsvc.py", line 295, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "E:\openerp\openerp\service\web_services.py", line 614, in dispatch
res = fn(db, uid, *params)
File "E:\openerp\openerp\osv\osv.py", line 169, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "E:\openerp\openerp\osv\osv.py", line 123, in wrapper
return f(self, dbname, *args, **kwargs)
File "E:\openerp\openerp\osv\osv.py", line 179, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "E:\openerp\openerp\addons\audittrail\audittrail.py", line 514, in execute_cr
return fct_src(cr, uid, model, method, *args, **kw)
File "E:\openerp\openerp\osv\osv.py", line 166, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "E:\openerp\openerp\addons\email_template\wizard\mail_compose_message.py", line 85, in onchange_template_id
values['attachment_ids'].append(ir_attach_obj.create(cr, uid, data_attach, context=context))
File "E:\openerp\openerp\addons\document\document.py", line 121, in create
vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None)
File "E:\openerp\openerp\addons\document\document.py", line 132, in _index
mime, icont = cntIndex.doIndex(data, datas_fname, file_type or None, None)
TypeError: 'NoneType' object is not iterable
谢谢大家帮忙看看