我想將總金額轉換爲發票中的字母,因爲我使用函數amount_to_text,但它不起作用,不顯示任何內容,這裏是我的代碼odoo v9如何將數量轉換爲文本量?
account_invoice.py(C:\ Programme文件(x86)\ Odoo 9.0-20170309 \服務器\ OpenERP的\插件\帳戶\型號\ account_invoice.py
@api.multi
def onchange_amount(self, amount_total):
x_Montant = amount_to_text_fr.amount_to_text(amount_total, 'fr', 'DZ')
return {'x_Montant': x_Montant}
我調用這個函數在C:\ Program Files文件(x86)的\ Odoo 9.0-20170309 \服務器\ openerp \ addons \ account \ views \ account_invoice_view
<record id="invoice_form" model="ir.ui.view">
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="arch" type="xml">
<form string="Invoice">
<header>
------
</header>
<div class="alert alert-info" role="alert" style="margin-bottom:0px;" attrs="{'invisible': [('has_outstanding','=',False)]}">
-----
<group>
<field name="date_invoice"/>
<field name="move_name" invisible="1"/>
<field name="user_id" groups="base.group_user" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'account.group_account_invoice']}"/>
<label for="currency_id" groups="base.group_multi_currency"/>
<div groups="base.group_multi_currency">
<field name="currency_id" options="{'no_create': True, 'no_open': True}" class="oe_inline"/>
<field name="company_currency_id" invisible="1"/>
</div>
</group>
</group>
<field name="sent" invisible="1"/>
<notebook colspan="4">
<page string="Invoice Lines">
<field name="invoice_line_ids" nolabel="1" widget="one2many_list" mode="tree,kanban" context="{'type': type, 'journal_id': journal_id, 'default_invoice_id': id}">
<tree string="Invoice Lines" editable="bottom">
<field name="sequence" widget="handle"/>
<field name="product_id"/>
<field name="name"/>
<field name="company_id" invisible="1"/>
<field name="account_id" groups="account.group_account_user"
domain="[('company_id', '=', parent.company_id), ('internal_type', '=', 'other')]"/>
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"
domain="[('company_id', '=', parent.company_id), ('account_type', '=', 'normal')]"/>
<field name="quantity"/>
<field name="uom_id" groups="product.group_uom"/>
<field name="price_unit"/>
<field name="discount" groups="sale.group_discount_per_so_line"/>
<field name="invoice_line_tax_ids" widget="many2many_tags" context="{'type':parent.type}"
domain="[('type_tax_use','=','sale'),('company_id', '=', parent.company_id)]" options="{'no_create': True}"/>
<field name="price_subtotal"/>
<field name="currency_id" invisible="1"/>
</tree>
<kanban class="o_kanban_mobile">
------
</kanban>
</field>
<group class="oe_subtotal_footer oe_rightoe_subtotal_footer oe_right">
<field name="amount_untaxed"/>
<field name="amount_tax"/>
**<field name="amount_total" class="oe_subtotal_footer_separator" on_change="onchange_amount(amount_total)" />**
<field name="payments_widget" colspan="2" nolabel="1" widget="payment"/>
<field name="residual" class="oe_subtotal_footer_separator" attrs="{'invisible': [('state', '=', 'draft')]}"/>
<field name="reconciled" invisible="1"/>
<field name="outstanding_credits_debits_widget" colspan="2" nolabel="1" widget="payment" attrs="{'invisible': [('state', 'not in', 'open')]}"/>
**<field name="x_Montant" />**
</group>
<field name="comment" placeholder="Terms and conditions..."/>
</page>