Skip to Content
Menu
This question has been flagged
2179 Rodiniai

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


Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
0
vas. 18
7548
0
vas. 18
5660
2
rugs. 22
8822
1
geg. 20
3801
2
spal. 18
6143