Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
4805 Näkymät

I need to print tax amount in every line based on tax percentage given in each line in invoice.

Kindly help me here!

Avatar
Hylkää

Please mention the version.

Tekijä

Version 14

Paras vastaus

Hello Sakthi Priya,

Hope you are doing well.

To print tax amount in every line based on tax percentage given in each line in invoice, you have to add new Monetary field into account.move.line model and display into invoice line tree view and also you have to write one onchange method based on tax_ids like below.

class AccountMoveLine(models.Model):
_inherit = 'account.move.line'

tax_amount_line = fields.Monetary(string='Total Amount', store=True, readonly=True,
currency_field='currency_id')

@api.onchange('tax_ids')
def check_tax_amount(self):
for rec in self:
if rec.tax_ids:
for tax in rec.tax_ids:
rec.tax_amount_line += (rec.price_unit * tax.amount) / 100
else:
rec.tax_amount_line = 0

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwar

Avatar
Hylkää

thanks a lot, you are the man!

but a little correction, you need to multiply again by rec.quantity

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
elok. 25
2723
1
heinäk. 25
1089
1
elok. 25
1151
0
toukok. 25
1518
2
huhtik. 25
3687