Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
2819 Widoki

my database value is 6205545687155.00000000

when I create journal entry by the create method of xmlrpc , the value in odoo change to  6205545687155.000977     

my python code :

debit_journal_item = {
'move_id': journal_entry_id,
'account_id'
: 3095,
'amount_currency'
: float(item[1]),
'currency_id'
: item[0],
'analytic_account_id'
: 89,
'debit'
: float(item[2])
}
journal_items.append(debit_journal_item)
models.execute_kw(db_name, uid, pwd, 'account.move.line', 'create', [journal_items])
Awatar
Odrzuć
Najlepsza odpowiedź

It looks like the issue you are experiencing might be related to a rounding error. When you create a journal entry with an amount of 6205545687155.00000000, the value gets rounded to 6205545687155.000977 in Odoo.

One potential solution to this issue would be to set the decimal precision for the 'amount' field in the 'account.move.line' model to a higher value. This will allow you to store more decimal places for the journal entry amounts, and avoid any rounding errors.

To do this, you can use the 'set_precision' method of the 'decimal.precision' class in the 'decimal_precision' module. Here is an example of how you could use this method to set the decimal precision for the 'amount' field in the 'account.move.line' model:

from decimal import precision

# Set the decimal precision for the 'amount' field in the 'account.move.line' model
# to 20 decimal places
decimal.precision('Account Move Line Amount').set_precision(20)

Once you have set the decimal precision for the 'amount' field, you should be able to create journal entries with higher precision amounts, and avoid any rounding errors.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lip 25
1552
0
sty 24
1523
1
lis 23
1790
1
wrz 23
2472
1
gru 24
1643