我想在 qweb 报告
上以 words
的形式获取采购订单
的总金额
。
有人请告诉我获取它的过程是什么或者我可以做什么代码......
我将非常感激...
最佳答案
在 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()" />
关于python-2.7 - qweb 报告 odoo 中的总字数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39014198/