Skip to content

Normalize VAT number

Daniel Palomar requested to merge fix/normalize-vat-number into master

We want to normalize the VAT numbers in our system following the next rules:

  • Remove dots (.), dashes (-) and spaces.
  • If is a Customer must have the ES prefix. Only customers. We need to create providers from other countries.

We also use the base_vat module which use the ckech_vat_es method of vatnumber Python lib, but this validation depends on vatand country_id fields.

Changing to required the vat and country_id fields in the ResPartner form force this validation.

We adapt the next models:

  • SubscriptionRequest: In validation method, we convert the vat received in a normalized spanish vat (ES prefix).
  • ResPartner: In create/write methods we normalize the VAT.
  • Also in the ResPartner search of the REST API we normalize the VAT received to improve the search.
Edited by Daniel Palomar

Merge request reports