tryton-ar / party_ar

Integrates party with AFIP
GNU General Public License v3.0
1 stars 3 forks source link

crash when run import afip census #16

Closed lukio closed 5 years ago

lukio commented 6 years ago

Since the implementation of WsPadronA5 (issue #14 ) It seems that AFIP is blocking the IP when there are many request from it.

party_ar tries to update the information of the iva_condition of the parties, and when does many request asking for the information of differentes cuits, at same point it brings null information. Perhaps, we could apply some kind of delay on the requests.

Traceback (most recent call last):
  File "/opt/trytond/trytond-server/trytond_dist/trytond/ir/cron.py", line 165, in _callback
    getattr(Model, cron.function)(*args)
  File "/opt/trytond/trytond-server/trytond_dist/trytond/modules/party_ar/party.py", line 383, in import_cron_afip
    cls.import_census(args)
  File "/opt/trytond/trytond-server/trytond_dist/trytond/model/modelview.py", line 617, in wrapper
    return func(cls, *args, **kwargs)
  File "/opt/trytond/trytond-server/trytond_dist/trytond/modules/party_ar/party.py", line 374, in import_census
    party.set_padron(padron, button_afip=False)
  File "/opt/trytond/trytond-server/trytond_dist/trytond/modules/party_ar/party.py", line 334, in set_padron
    self.save()
  File "/opt/trytond/trytond-server/trytond_dist/trytond/model/descriptors.py", line 31, in newfunc
    return self.func(owner, [instance], *args, **kwargs)
  File "/opt/trytond/trytond-server/trytond_dist/trytond/model/modelstorage.py", line 1459, in save
    (([r], save_values[r]) for r in to_write), ()))
  File "/opt/trytond/trytond-server/trytond_dist/trytond/model/modelsql.py", line 934, in write
    cls._validate(sub_records, field_names=all_field_names)
  File "/opt/trytond/trytond-server/trytond_dist/trytond/model/modelstorage.py", line 1012, in _validate
    required_test(getattr(record, field_name), field_name)
  File "/opt/trytond/trytond-server/trytond_dist/trytond/model/modelstorage.py", line 987, in required_test
    error_args=cls._get_error_args(field_name))
  File "/opt/trytond/trytond-server/trytond_dist/trytond/error.py", line 74, in raise_user_error
    raise UserError(error)
UserError: ('UserError', (u'El campo \xabNombre\xbb en \xabEntidad\xbb es requerido.', ''))
lukio commented 5 years ago

Finally, the problem was that it does not bring information and we were validating padron but not padron.data