Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
2849 Vizualizări

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])
Imagine profil
Abandonează
Cel mai bun răspuns

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.

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
iul. 25
1593
0
ian. 24
1575
1
nov. 23
1826
1
sept. 23
2512
1
dec. 24
1679