qweb 报告 odoo 中的总字数

Total amount in words in qweb report odoo

我想在 qweb reportwords 中获得 purchase ordertotal amount。 有人请告诉我获得它的过程是什么或者我可以做什么代码...... 我会非常感激...

在您的 purshase.order 模型中创建一个函数,将 total_amount 转换为字母。

from openerp import models, api
from openerp.tools import amount_to_text_fr

class purchase_order(models.Model):
    _inherit = 'purchase.order'

    @api.depends('amount_total', 'currency_id')
    def compute_text(self):
        return amount_to_text_fr(self.amount_total, self.currency_id.symbol)

要从 QWEB 报告中调用它,请使用:

<span t-esc="o.compute_text()" />