Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2321 Zobrazení

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
úno 18
7691
0
úno 18
5788
2
zář 22
8928
1
kvě 20
3911
2
říj 18
6235