Open ERP API change for V6.1
-
OpenERP API 在开发分支中(未来V6.1版本)有以下变化:
1) fields.function() does not take a "method" parameter anymore [1]. It
was useless and every field was passing method=True. It is possible to
pass a normal function too, it simply needs to have the proper signature
(see the docstring). Don't forget to run 'bzr pull' on the server,
otherwise the trunk addons will not work anymore.
And please do not use the "method" parameter anymore in trunk! (it's
ignored, though, so it's backwards compatible)
function字段定义不需要“method”参数了
2) There is no need to call the constructor of each osv object anymore
after defining it. This is now done automagically by the osv
metaclass[2], so you can save this line for every osv object you
declare. Calling the constructor will not hurt, but it's unnecessary.
在定义好osv对象,不需要再去调用执行了,(这个好啊,我自己经常会忘记调用)比如:
class myobj(osv.osv):
.....
myobj() <----不需要了
3) You don't need to split osv classes when there are circular
references, such as users <-> groups. Modules are now loaded in several
passes to resolve the dependencies [2].
看看res.users模块,users和groups分别有many2many的字段指向对方,以前我们只能创建groups,在users定义之后再创建groups2(继承groups,并定义与users关联的many2many字段)
现在不需要那么麻烦了。直接分别定义就好了 -
[quote author=mrshelly link=topic=2531.msg8357#msg8357 date=1310708644]
但这样底层的大动作... 对于partner 来讲,,, 太过痛苦了...
[/quote]
这些改变基本上保持了向后兼容,应该问题不大
[quote author=wjfonhand link=topic=2531.msg8358#msg8358 date=1310737877]
不知道什么时候能像tryton那样不必每次调用和定义method的时候都写cr,uid这类的参数。
[/quote]
这些不是不能改,只是改了以后保持向后兼容的难度比较大