跳至內容
選單
此問題已被標幟
2172 瀏覽次數

How to change quantity field decimal number based on field decimal_digit record

class AccountAnalyticInvoiceLine(models.Model):
    _inherit = 'account.analytic.invoice.line'
    quantity = fields.Float(digits=(16, 2)
class AccountInvoice(models.Model):
    _inherit = 'account.invoice'
    
    decimal_digit = fields.Integer(string='Decimal Digit', default=2)

I tried

@api.onchange('decimal_digits')
    def _onchange_decimal_digits(self):
        for record in self:
            record.quantity = round(record.quantity, record.decimal_digits)

but it seems not working


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
2月 18
7540
0
2月 18
5658
2
9月 22
8819
1
5月 20
3789
2
10月 18
6140