Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5273 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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



Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 9 23
7195
0
thg 9 23
29
0
thg 9 22
2839
0
thg 9 24
1580
PDF reports Đã xử lý
5
thg 7 25
2369