How to recompute stored functional field values in Odoo?

前端 未结 4 1271
日久生厌
日久生厌 2020-12-09 21:50

Sometimes stored fields must be recomputed, but triggers can not be launched (e.g. in case of SQL injection).

How to recompute them an easy way?

4条回答
  •  执笔经年
    2020-12-09 22:29

    (Because I came here via google:)

    You can also do this from the Odoo Shell:

    # python odoo.py shell -c openerp-server.conf  -d 
    
    >>> model = env['account.invoice']
    >>> env.add_todo(model._fields['amount_total'], model.search([]))
    >>> model.recompute()
    >>> env.cr.commit()
    

    Odoo shell is available in 9, 10 and via an OCA module in 8.

提交回复
热议问题