Fields.function store=True 执行次数的问题(已解决)
-
今天遇见了一个问题 就是在fields.function 的字段声明的时候 ,在store=True的情况下 函数还是在每次对象write的情况下都要执行一次,这样的情况下会很耗性能
经过jeff的帮助下 找到了一个解决方法 就是在store={'对象':(不变的字段)} 例如::
'delivery_date': fields.function (day_date_delivery,type="char",
store={'mrp.production': (lambda self, cr, uid, ids, c={}: ids, ['name'], 10),}, string='送货日期'),
就能很好的解决问题!这个应该是官方修改出来的bug还是一个什么情况 有点时候我们很像实现每次编辑的重新执行函数一次。。以前还有没有这个问题 。现在要是用store=True就要小心点了!!
听jeff说 上海-Joshua 说过这样一句话 store=true 相当于 store = {self._name:(lambda self, cr, uid, ids, c={}: ids, [ ], 10) }
希望对大家有 帮助 -
http://stuartl.longlandclan.yi.org/blog/2013/04/05/openerp-function-store/ 再次发个连接 ccdos提供 感觉不错
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login