Skip to content

Commit

Permalink
issue #5 add imports at the top of the file. if company is not define…
Browse files Browse the repository at this point in the history
…d raise an error
  • Loading branch information
lukio committed Dec 12, 2017
1 parent 0ec5001 commit 3f05c84
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion party.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.

from pyafipws.ws_sr_padron import WSSrPadronA4
import stdnum.ar.cuit as cuit
import stdnum.exceptions
from actividades import CODES
Expand Down Expand Up @@ -329,11 +330,13 @@ def search_vat_number_afip_foreign(cls, name, clause):
def get_ws_afip(cls, vat_number):
try:
# authenticate against AFIP:
from pyafipws.ws_sr_padron import WSSrPadronA4
ws = WSSrPadronA4()
Company = Pool().get('company.company')
if Transaction().context.get('company'):
company = Company(Transaction().context['company'])
else:
logger.error('The company is not defined')
cls.raise_user_error('company_not_defined')
auth_data = company.pyafipws_authenticate(service='ws_sr_padron_a4')
# connect to the webservice and call to the test method
ws.LanzarExcepciones = True
Expand Down

0 comments on commit 3f05c84

Please sign in to comment.