Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

The Odyssey of Formatting a number into currency

By
E.M.
on 1/4/16, 6:27 PM 410 views

I am adding some monetary amounts to the Stock.Picking / Stock.Move reports.

I get the following error:

  File "/usr/lib/python2.7/dist-packages/openerp/addons/base/ir/ir_qweb.py", line 1001, in _format
    precision = int(round(math.log10(display.rounding)))
QWebException: 'int' object has no attribute 'rounding'
While trying:

 <span class="text-right" t-esc="move.order_price" t-esc-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: &quot;1&quot;}"/>


move.order_price has been added to the model and it is basically sale order line's price_subtotal; while move is the iteration over stock moves in the qweb report

Note that as I am not in invoice or sale order I lack currency_id and therefore I am hardcoding "1" Euro to the report.


class StockMove(models.Model):
    _inherit = 'stock.move'
    order_price = fields.Float(string="Purchase subtotal", related='purchase_line_id.price_subtotal')

 


Any help is really welcomed,

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/4/16, 6:27 PM
Seen: 410 times
Last updated: 1/4/16, 6:30 PM