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

digits :

'exchange_rate': fields.related('currency_id', 'rate', type='float', string='Exchange Rate', digits=(12,6)),


or digits_compute defined value :

xml

<record forcecreate="True" id="decimal_account" model="decimal.precision">

     <field name="name">Account</field>

     <field name="digits">2</field>

</record>

python

import openerp.addons.decimal_precision as dp

'credit': fields.function(__compute, fnct_inv=_set_credit_debit, digits_compute=dp.get_precision('Account'), string='Credit', multi='balance'),


or digits_compute function :

from openerp import SUPERUSER_ID

import openerp

def get_precision_tax():

     def change_digit_tax(cr):

         res = openerp.registry(cr.dbname)['decimal.precision'].precision_get(cr, SUPERUSER_ID, 'Account')

         return (16, res+3)

return change_digit_tax


'amount': fields.float('Amount', required=True, digits_compute=get_precision_tax(), help="For Tax Type percent enter % ratio between 0-1."),

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 11 22
8012
1
thg 4 16
4481
1
thg 6 15
4373
1
thg 6 15
3246
0
thg 3 15
3461