from odoo import models, fields, api
from odoo.addons import decimal_precision as dp
class AccountInvoiceSumLine(models.Model):
_name = 'account.invoice.sum.line'
_description = 'Account Invoice Sum Line'
account_move_id = fields.Many2one('account.move', string="Move ID")
product_id = fields.Many2one('product.product', string="Product")
product_uom_qty = fields.Float(string="Ordered Quantity", digits=dp.get_precision('Product Unit of Measure'))
uom_id = fields.Many2one('uom.uom', string="Unit of Measure", related='product_id.uom_id')
此問題已被標幟
1
回覆
1682
瀏覽次數
Hi,
In Odoo 19, float precision is handled directly through the digits attribute on fields, not via dp.get_precision().
The fix is to remove the decimal_precision import and define the precision as digits="Product Unit of Measure" on the field. This is an expected breaking change during migration to Odoo 19.
Try the code below.
product_uom_qty = fields.Float(
string="Ordered Quantity",
digits="Product Unit of Measure"
)
Hope it helps
| 相關帖文 | 回覆 | 瀏覽次數 | 活動 | |
|---|---|---|---|---|
|
|
3
11月 25
|
2340 | ||
|
|
4
11月 25
|
2513 | ||
|
|
0
7月 23
|
6 | ||
|
|
1
11月 19
|
9666 | ||
|
|
1
3月 15
|
5253 |
What about this import? Is it deprecated? What Can I Replace this Import? Is it no need?