Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4785 Lượt xem

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

Kindly help me here!

Ảnh đại diện
Huỷ bỏ

Please mention the version.

Tác giả

Version 14

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

thanks a lot, you are the man!

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 8 25
2646
1
thg 7 25
1031
1
thg 8 25
1151
0
thg 5 25
1489
2
thg 4 25
3645