Adding more company identifiers

Hey guys,
I’m new to the community and Tryton, so I need a little help on how to add more types of identifiers in companies.
The problem is that, I’m Angolan and the VAT numbers in here do not pass on Check VIES when I try to add a VAT identifier. So I thought of adding a new identifier so I can add our VAT number but I cannot find the place to add a new identifier.
Can someone please help me with this.

Thank you so much for everything

Hi and welcome to the community,
you should create a new module and extend the type field of party identifier. It should look something like this:

class PartyIdentifier:
    __name__ = 'party.identifier'
    __metaclass__ = PoolMeta
    
    @classmethod
    def __setup__(cls):
        super(PartyIdentifier, cls).__setup__()
        cls.type.selection.append(('ao_vat', 'Angolan VAT'))

Hey albert,
Thanks for your fast reply, I will try to add a new module as you explained and see ;)…
Is there another way of doing this? I was thinking that I could just deactivate the Check VIES wizard, and if some day I need it I could just activate it again. I’ve tried to deactivate it and it does not work, tryton still does the check and I couldn’t add the VAT identifier.

I think your issue is not with the check of the wizard but with the validation of the identifier itself. If the type is ‘eu_vat’, it validate the checksum of the number for European VAT. If you set the type to empty, there will be no validation.

Indeed the validation is based on python-stdnum and there was an idea to provide all the types from the libraries by default. This would prevent to have to create new module as this library has almost all the existing VAT number.

Yeah, when I set the type to empty, and save the VAT number there is no validation but the VAT number does not appear in the invoices or any other documents that I want the VAT number to appear.

Indeed the invoice allows only the type returned by Ìnvoice._tax_identifier_types`. So until we have a generic solution to include all type from pyton-stdnum, you must add your own type.

Won’t be better to include all the types in the party module so they are available for everyone?

Not all type of identifiers are valid as tax identifier.

Yes I know, but for now we had requests for Australian VAT and for Angolan VAT. So I’m wondering if it’s not better to include both identifiers instead of waiting for including all.

I think we should have this configurable by the user. So we would need the list of all available in python-stdnum and define which one are used in identifier and which one are used for tax.

1 Like

Thank you so much guys.
I got it to work. After creating a new module called party_ao_identifier, I could install it on the tryton server and then activate the module in the tryton client.
Now I have the option of choosing the Angolan identifier, which it’s called NIF, as it is called as well in Portugal and other European countries.

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