fix the decimal accuracy

This commit is contained in:
admin.suherdy 2025-11-22 08:42:01 +07:00
parent 66514f0061
commit 8905caded4
4 changed files with 16 additions and 3 deletions

View File

@ -1,5 +1,18 @@
# Changelog # Changelog
## [17.0.1.0.2] - 2025-11-22
### Fixed
- **CRITICAL FIX**: Increased precision from 6 to 10 decimal places
- Fixed issue where 1,264,733 would display as 1,264,732.98
- Now handles both small and large quantities accurately
### Technical Details
- Changed `digits=(16, 6)` to `digits=(16, 10)` for maximum precision
- Test cases:
- 277,534 ÷ 150 = 1850.2266666667 → 277,534.00 ✅
- 1,264,733 ÷ 60,000 = 21.0788833333 → 1,264,733.00 ✅
## [17.0.1.0.1] - 2025-11-21 ## [17.0.1.0.1] - 2025-11-21
### Fixed ### Fixed

View File

@ -1,6 +1,6 @@
{ {
"name": "Vendor Bill Editable Totals", "name": "Vendor Bill Editable Totals",
"version": "17.0.1.0.1", "version": "17.0.1.0.2",
"summary": "Enable direct editing of tax excluded and tax included amounts on vendor bill lines with automatic unit price recalculation", "summary": "Enable direct editing of tax excluded and tax included amounts on vendor bill lines with automatic unit price recalculation",
"description": """ "description": """
Vendor Bill Editable Totals Vendor Bill Editable Totals

View File

@ -11,7 +11,7 @@ class AccountMoveLine(models.Model):
# Override price_unit to use more decimal places # Override price_unit to use more decimal places
price_unit = fields.Float( price_unit = fields.Float(
string='Unit Price', string='Unit Price',
digits=(16, 6), # Use 6 decimal places instead of the default 2 digits=(16, 10), # Use 10 decimal places for maximum precision
) )
@api.onchange('price_subtotal') @api.onchange('price_subtotal')
@ -38,7 +38,7 @@ class AccountMoveLine(models.Model):
# Formula: price_unit = price_subtotal / quantity # Formula: price_unit = price_subtotal / quantity
new_price_unit = line.price_subtotal / line.quantity new_price_unit = line.price_subtotal / line.quantity
# Set the price_unit - now with 6 decimal precision # Set the price_unit - now with 10 decimal precision
line.price_unit = new_price_unit line.price_unit = new_price_unit
@api.onchange('price_total') @api.onchange('price_total')