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

[15.0][UPD] l10n_ro_partner_create_by_vat_button_vies #207

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions l10n_ro_partner_create_by_vat_button/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Romania - Partner Create by VAT Button
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b7ea1a713e84cf52c890e1bdf285d0637578a02033e543e334cf0d89a356a441
!! source digest: sha256:921a3276d297d5675bfb54ca95b8118a4f3de208aa9c18ddc39467cb19a3935b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -22,7 +22,7 @@ Romania - Partner Create by VAT Button

|badge1| |badge2| |badge3|

- Adaugare buton in ecran pentru recitire date ANF
- Adaugare buton in ecran pentru recitire date ANAF
-

**Table of contents**
Expand Down
2 changes: 1 addition & 1 deletion l10n_ro_partner_create_by_vat_button/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Romania - Partner Create by VAT Button",
"license": "AGPL-3",
"version": "15.0.1.0.6",
"version": "15.0.1.0.7",
"author": "Dorin Hongu," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-romania",
"category": "Localization",
Expand Down
15 changes: 12 additions & 3 deletions l10n_ro_partner_create_by_vat_button/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,19 @@ def get_partner_name_from_vies(self):
client = Client("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl")

# Make a request to the VIES service to check the VAT number
response = client.service.checkVat(countryCode=self.name[:2], vatNumber=self.name[2:])
if not self.vat.isdigit():
vat_number = self.vat[2:]
country_code = self.vat[:2]
elif self.country_id:
vat_number = self.vat
country_code = self.country_id.code
else:
raise UserError(_("Please add the country code to the vat number or country field"))

response = client.service.checkVat(countryCode=country_code, vatNumber=vat_number)
if response.valid:
self.vat = self.name
self.country_id = self.env["res.country"].search([("code", "ilike", self.name[:2].lower())])[0].id
self.vat = vat_number
self.country_id = self.env["res.country"].search([("code", "ilike", country_code)])[0].id
self.name = response.name
self.street = response.address
else:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
- Adaugare buton in ecran pentru recitire date ANF
- Adaugare buton in ecran pentru recitire date ANAF
-
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,12 @@ <h1 class="title">Romania - Partner Create by VAT Button</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b7ea1a713e84cf52c890e1bdf285d0637578a02033e543e334cf0d89a356a441
!! source digest: sha256:921a3276d297d5675bfb54ca95b8118a4f3de208aa9c18ddc39467cb19a3935b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/dhongu/l10n-romania/tree/15.0/l10n_ro_partner_create_by_vat_button"><img alt="dhongu/l10n-romania" src="https://img.shields.io/badge/github-dhongu%2Fl10n--romania-lightgray.png?logo=github" /></a></p>
<blockquote>
<ul class="simple">
<li>Adaugare buton in ecran pentru recitire date ANF</li>
<li>Adaugare buton in ecran pentru recitire date ANAF</li>
<li></li>
</ul>
</blockquote>
Expand Down
Loading