Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Show one2many field in a tree view of different model [Odoo]

MaharshiRawal:

I want to display all the taxes that are applied in a particular invoice and their amounts[in the Tree view of a model account.invoice] The output is as such:

The column Tax Lines shows the ids of the taxes that are present in table account.invoice.tax (whereas I want to show their names and corresponding amount)

The model account.invoice has a field called tax_line_ids[Tax Lines] that contains the record of all the taxes on a invoice which is stored in a separate table account.invoice.tax, which in its own tree view looks like this:

I want to extract the tax name and its corresponding amount for it to reflect in account.invoice's tree view

Here's my python code which does'nt seem to work:


@api.one
def taxz(self):
tax_pool = self.pool.get("account.tax")
found_taxes = tax_pool.read(cr, uid, [tax_id,], ["tax_line_ids"], context)
found_tax = found_taxes[0] if found_taxes else None
tax_line_ids = found_tax["tax_line_ids"]
_logger.critical("context type: " + type(context))
_logger.critical("context content: " + str(context))
_logger.critical(tax_line_ids)

xml code for the view:






Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Show one2many field in a tree view of different model [Odoo]

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×