<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[计算字段重新计算]]></title><description><![CDATA[<p dir="auto">请教下，下面这个是什么时候会触发这个重新计算的方法，会重复触发吗？具体怎么使用？</p>
<p dir="auto">摘录：<br />
在系统开发过程中会遇到将非<code>compute</code>字段 改为<code>compute</code>字段的情况，这个时候数据库中存储过的该字段如果没有再次触发,字段值将不会更新。为了解决这个问题可以用下面这段代码来触发，指定对象指定字段的<code>compute</code>计算。</p>
<pre><code>model = env['model.name']
env.add_todo(model._fields['field.name'], model.search([]))
model.recompute()
env.cr.commit()
</code></pre>
]]></description><link>https://odoo.net.cn/topic/5218/计算字段重新计算</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Mar 2026 20:50:08 GMT</lastBuildDate><atom:link href="https://odoo.net.cn/topic/5218.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 16 Aug 2018 03:29:58 GMT</pubDate><ttl>60</ttl></channel></rss>