Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2234 Visninger

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
Kassér
Related Posts Besvarelser Visninger Aktivitet
0
feb. 18
7619
0
feb. 18
5753
2
sep. 22
8871
1
maj 20
3837
2
okt. 18
6179