我想添加自定义字段作为税额,我需要在odoo11的帐户发票行中打印该订单行的税额
谢谢, 阿南德
答案 0 :(得分:0)
@api.one
@api.depends('price_unit', 'discount', 'invoice_line_tax_ids', 'quantity',
'product_id', 'invoice_id.partner_id', 'invoice_id.currency_id')
def _compute_price_tax(self):
price = self.price_unit * (1 - (self.discount or 0.0) / 100.0)
currency = self.invoice_id and self.invoice_id.currency_id or None
if self.invoice_line_tax_ids:
taxes = self.invoice_line_tax_ids.compute_all(price, currency, self.quantity, product=self.product_id, # call the base function
partner=self.invoice_id.partner_id)
tax_amount = 0
if taxes['total_included']:
tax_amount = taxes['total_included'] - taxes['total_excluded']
self.price_subtotal_tax = tax_amount
if self.invoice_id:
self.price_subtotal_tax = self.invoice_id.currency_id.round(self.price_subtotal_tax)