amount_untaxed = fields.Monetary(string='Untaxed Amount',
store=True, readonly=True, compute='_compute_amount', track_visibility='always')
amount_tax = fields.Monetary(string='Tax',
store=True, readonly=True, compute='_compute_amount')
amount_total = fields.Monetary(string='Total',
store=True, readonly=True, compute='_compute_amount')
@api.one
@api.depends('invoice_line_ids.price_subtotal', 'tax_line_ids.amount', 'currency_id', 'company_id', 'date_invoice', 'type')
def _compute_amount(self):
round_curr = self.currency_id.round
self.amount_untaxed = sum(line.price_subtotal for line in self.invoice_line_ids)
self.amount_tax = sum(round_curr(line.amount) for line in self.tax_line_ids)
self.amount_total = self.amount_untaxed + self.amount_tax
Sie sehen account.invoice Standard kann Modul geschätzt. Aktualisiere den Datensatz immer während der Erstellung. Im benutzerdefinierten Modul In create method den Datensatz wie oben beschrieben aktualisieren.
Do not nur hinter dem Code so erklären es – Cherif