Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
5196 Представления

I want to display separator for the 'Quantity' field in the report. It works fine for the amount. Here is the code for it: t-esc-options='{"widget": "monetary", "display_currency": "o.currency_id"}' .

Now, If I use the same code  with removing  "display currency" key from above code (because Quantity does not need to show currency symbol) then it gives me the error while printing report:

display = self.pool['ir.qweb'].eval_object(options['display_currency'], qwebcontext)

QWebException: "display_currency" while evaluating

"translate_doc(doc_id, doc_model, 'partner_id.lang', 'account.report_invoice_document')"


If I use with "display_currency" key then it prints without error but the problem is currency symbol in Quantity field. Is there any way to display separator in PDF?

Аватар
Отменить
Автор Лучший ответ

I did it with formatLang function. I made following changes:

in XML:

<span t-esc="formatLang(l.product_qty),digits=1)"/>  (digits=1 is used to display 1 digit after decimal.)

in py:

from openerp.report import report_sxw

class report_invoice_report(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(report_invoice_report, self).__init__(cr, uid, name, context)

class wrapped_report_contribution_register(osv.AbstractModel):
    _name = 'report.account.report_invoice'
    _inherit = 'report.abstract_report'
    _template = 'account.report_invoice'
    _wrapped_report_class = report_invoice_report



Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
сент. 23
7012
0
сент. 23
29
0
сент. 22
2744
0
сент. 24
1432
PDF reports Решено
5
июл. 25
2195