Party identifiers in invoice

how could we add 2 party indentifiers in an invoice.

For the moment relatorio is said

<if test="invoice.party.tax_identifier">
<invoice.party.tax_identifier.type_string>: <invoice.party.tax_identifier.code>
</if>

it seems to picks only the first element of identifiers. how could we change to pick the first 2 ?

You can iterate through any 2Many field.

party.tax_identifier is not the same as party.identifiers.

party.identifiers is the list of all the identifiers, otherwise, party.tax_identifier is the first identifier of identifiers that it’s purposed for taxes.

You can show it in your reports with:

<for each="idnt in invoice.party.identifiers">
<idnt.type_string>: <idnt.code>
</for>

thank you so much… a more general question how could we decide if it is on the same line or on different new lines ?

i decided to use <invoice.party.identifiers[0].code> and <invoice.party.identifiers[1].code> but we must create them in the right order

Since Add party tax identifier on invoice (fbf4ff4f5ad0) · Commits · Tryton / Tryton · GitLab (7 years ago) the invoice stores the tax identifier of the party (by default the first one is picked when selecting the party). So you can change it before posting if needed (or even customize the selection depending on some rule).

thank you for the interesting link

sorry, I did not understand your question.

when i use your code, i get :

tva : FR4480873456
siren 428712345

it would be nice to have

tva : FR4480873456 siren 428712345

i guess i should use something like join if exist but i did not find a documentation somewhere to work on that and be more autonomous

There is the Party SIRET module which provides a siren attribute on the party.

So if your goal is to display the Tax identifier and the SIREN, you should just add the SIREN next to the party tax identifier in the report template.

And to get them on a single line, you must put all the <if test> also on a single line.

you must put all the <if test> also on a single line.

if you do that, it stop working

not everywhere on the invoice, i will look better to understand

Also, you could create a property in a custom module and use it in the report:


class Invoice(metaclass=PoolMeta):
    __name__ = 'account.invoice'

    @property
    def report_party_identifiers(self):
        party_identifiers = list(i.code for i in self.party.identifiers)
        return ','.join(party_identifiers)

it looks so easy when i read your solutions

you seems to well known tryton, i am looking at the code to understand how to do things but i did not find somewhere something that could help me in computing the numbers of lines and the number of product in a sale.

what is similar i looked in invoice, account_move…

i found my way :wink: i understood how it works…

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.