콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
2288 화면

hi all , iam having a custom report and when printing its showing the below error


in py :

from openerp.tools import amount_to_text

from openerp.tools import amount_to_text_en

    def amount_to_text(self, amount, currency='Dirham'):

        return amount_to_text(amount, 'en','Dirham')

       

    def amount_to_text_dollar(self, amount, currency='Dollar'):

        return amount_to_text_en.amount_to_text_dollar(amount,'Dollar')



in report:


<td colspan="6" style="font-family:Arial;font-size:15px;padding:2mm;text-align:left;width:100%;" width="100%"><strong>Total Amount in Words:</strong>&amp;nbsp;&amp;nbsp;<span t-esc="o.amount_to_text_dollar(o.amount_total,'Dollar')" /></td>


ERROR :

    return amount_to_text_en.amount_to_text_dollar(amount,'Dollar')
QWebException: "'module' object has no attribute 'amount_to_text_dollar'" while evaluating
"o.amount_to_text_dollar(o.amount_total,'Dollar')"


someone help me with this , version is odoo 8


아바타
취소
베스트 답변

Hi,

    Accessing the amount_to_text should be changed like,

from openerp.tools import amount_to_text_en

def amount_to_text(self, amount, currency):

        convert_amount_in_words = amount_to_text_en.amount_to_text(amount, lang='en', currency='')        

        return convert_amount_in_words

In xml,

<span t-esc="o.amount_to_text(o.amount_total, o.currency_id)"/>  

Hope it works,

Thanks

아바타
취소
관련 게시물 답글 화면 활동
0
5월 15
2854
0
4월 15
3880
0
3월 15
5524
1
4월 22
22474
2
2월 21
11082