Ir al contenido
Menú
Se marcó esta pregunta
2057 Vistas

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


Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
feb 18
7441
0
feb 18
5609
2
sept 22
8729
1
may 20
3647
2
oct 18
6010