Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Buchhaltung
- Lager
- PoS
- Project
- MRP
Diese Frage wurde gekennzeichnet
1
Antworten
1554
Ansichten
How to caculate amount_total without discount additionally in invoice in odoo 14?
Hi,
You can inherit the _compute_amount function that computes the value to amount_total field and make necessary changes.
Thanks
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!
Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!
Registrieren
Hi,
from odoo import api, fields, models
class AccountInvoice(models.Model):
_inherit = "account.move"
@api.depends('invoice_line_ids.price_subtotal', 'tax_line_ids.amount', 'tax_line_ids.amount_rounding',
'currency_id', 'company_id', 'date_invoice', 'type')
def _compute_amount(self):
super(AccountInvoice, self)._compute_amount()
self.amount_total_no_discount = sum(self.invoice_line_ids.mapped('price_subtotal_no_discount'))
amount_total_no_discount = fields.Monetary(string='Total without discount', store=True, readonly=True,
compute='_compute_amount')
class AccountInvoiceLine(models.Model):
_inherit = "account.move.line"
@api.depends('price_unit', 'discount', 'invoice_line_tax_ids', 'quantity', 'product_id', 'invoice_id.partner_id',
'invoice_id.currency_id', 'invoice_id.company_id','invoice_id.date_invoice', 'invoice_id.date')
def _compute_price(self):
super(AccountInvoiceLine, self)._compute_price()
if self.invoice_line_tax_ids:
taxes = self.invoice_line_tax_ids.compute_all(self.price_unit, self.invoice_id.currency_id, self.quantity,
product=self.product_id, partner=self.invoice_id.partner_id)
self.price_subtotal_no_discount = taxes['total_included']
else:
self.price_subtotal_no_discount = self.price_unit * self.quantity
price_subtotal_no_discount = fields.Monetary(string='Amount without discount', store=True, readonly=True,
compute='_compute_price')
This code don't work on odoo14.
How to edit it for working on odoo 14?
Thank's
please help me!