Se rendre au contenu
Menu
Cette question a été signalée

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
Ignorer
Publications associées Réponses Vues Activité
0
févr. 18
7562
0
févr. 18
5674
2
sept. 22
8836
1
mai 20
3803
2
oct. 18
6149