Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0][FIX] control vat format on vat client listing #216

Open
wants to merge 2 commits into
base: 12.0
Choose a base branch
from

Conversation

victor-champonnois
Copy link
Member

@victor-champonnois victor-champonnois commented Mar 1, 2024

Belgian VAT number now can start with a 1 rather than a 0 (see https://www.easytax.co/fr/tax-mag/info/belgique-changement-de-format-pour-les-numeros-de-tva-belges/)

Also autoremove the dots in the VAT numbers (they are not checked by the VIES control, but produce errors in the VAT client listing report)

forward ported in v14 : #217

@victor-champonnois victor-champonnois force-pushed the 12.0-fix-vat-check-on-vat-client-list branch from 58f7d28 to 6ee6d81 Compare March 1, 2024 15:55
@victor-champonnois victor-champonnois changed the title [12.0][FIX] control on vat format [12.0][FIX] control vat format on vat client listing Mar 1, 2024
company_vat = company_vat.replace(" ", "").upper()
company_vat = company_vat.replace(" ", "").replace(".", "").upper()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is done in 2 places, it should go into a function.

also, to avoid multiple replace operations, re.sub() can be used:

company_vat = re.sub("[ .]", "", company_vat).upper()

or maybe use fix_eu_vat_number() from the base_vat module directly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, using fix_eu_vat_number works, and it's a better solution, thanks :)
I port this change to the 14 branch

be_vat_pattern = re.compile(r"^BE0[1-9]{1}[0-9]{8}$")
be_vat_pattern = re.compile(r"^BE[0-1][0-9]{9}$")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous pattern forbid numbers starting with "00", while this does not. is this ok?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, according to this source, the format is 0xxx.xxx.xxx or 1xxx.xxx.xxx

@victor-champonnois victor-champonnois force-pushed the 12.0-fix-vat-check-on-vat-client-list branch from 2139d9c to 1224070 Compare March 6, 2024 11:21
Copy link
Member

@huguesdk huguesdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one slight change to do, squash all commits and we’ll be good to go. approving already to save time.

edit: and pre-commit should be run.

@@ -140,7 +141,8 @@ def get_partners(self):
self.env.cr.execute(query, args)
seq = 0
for record in self.env.cr.dictfetchall():
record["vat"] = record["vat"].replace(" ", "").upper()
be_id = self.env.ref("base.be").id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line should be moved out of the loop.

@victor-champonnois victor-champonnois force-pushed the 12.0-fix-vat-check-on-vat-client-list branch from 1224070 to 0a56ed1 Compare March 6, 2024 13:29
@victor-champonnois
Copy link
Member Author

@huguesdk done !

Copy link
Contributor

@robinkeunen robinkeunen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks !

@robinkeunen
Copy link
Contributor

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 12.0-ocabot-merge-pr-216-by-robinkeunen-bump-minor, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Apr 19, 2024
Signed-off-by robinkeunen
@OCA-git-bot
Copy link
Contributor

@robinkeunen your merge command was aborted due to failed check(s), which you can inspect on this commit of 12.0-ocabot-merge-pr-216-by-robinkeunen-bump-minor.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Aug 18, 2024
@huguesdk
Copy link
Member

@OCA/local-belgium-maintainers could you please merge this?

@sbidoul
Copy link
Member

sbidoul commented Aug 19, 2024

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 12.0-ocabot-merge-pr-216-by-sbidoul-bump-patch, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Aug 19, 2024
Signed-off-by sbidoul
@OCA-git-bot
Copy link
Contributor

@sbidoul your merge command was aborted due to failed check(s), which you can inspect on this commit of 12.0-ocabot-merge-pr-216-by-sbidoul-bump-patch.

After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red.

@sbidoul
Copy link
Member

sbidoul commented Aug 19, 2024

Hm weird error. I'll need to look into this.

@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants