 <pre class="lang-py prettyprint-override"><code>record.x_sum_stored_taxes_exclude_withholding =\ sum(line.amount for line in record.x_sum_stored_taxes_exclude_withholding) </code></pre> <p>You should use `tax_line_ids ?</p> <pre class="lang-py prettyprint-override"><code>record.x_sum_stored_taxes_exclude_withholding =\ sum([line.amount for line in record.tax_line_ids]) </code></pre> <p>And ofcourse you need only positive values:</p> <pre class="lang-py prettyprint-override"><code>record.x_sum_stored_taxes_exclude_withholding =\ sum([line.amount for line in record.tax_line_ids if line.amount &gt;= 0.0]) </code></pre>