Skip to Content
Menu
This question has been flagged
1 Reply
1855 Views

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])
Avatar
Discard
Best Answer

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.

Avatar
Discard
Related Posts Replies Views Activity
0
Jan 24
382
0
Nov 23
344
1
Nov 23
457
1
Sep 23
1008
1
Dec 24
61