From de45a1645e64889b72cd6803e956a011f6b4b618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Mac=20Rouillon?= Date: Fri, 8 May 2020 14:54:34 -0300 Subject: [PATCH] [12.0] [PORT] from 11.0 [11.0] [FIX] l10n_ar_account_withholding: Fix a bug when the date is 0000-00-00 for new inscription to padron. --- .../models/res_company.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/l10n_ar_account_withholding/models/res_company.py b/l10n_ar_account_withholding/models/res_company.py index 4046edded..0111eb537 100644 --- a/l10n_ar_account_withholding/models/res_company.py +++ b/l10n_ar_account_withholding/models/res_company.py @@ -216,16 +216,16 @@ def get_cordoba_data(self, partner, date): dict_alic = json_body.get("sdtConsultaAlicuotas") alicuota_percepcion = float(dict_alic.get("CRD_ALICUOTA_PER")) alicuota_retencion = float(dict_alic.get("CRD_ALICUOTA_RET")) - - # Verificar que el comprobante tenga fecha dentro de la vigencia - from_date_date = fields.Date.from_string(dict_alic.get("CRD_FECHA_INICIO")) - to_date_date = fields.Date.from_string(dict_alic.get("CRD_FECHA_FIN")) - if not (from_date_date <= date_date < to_date_date): - raise UserError( - 'No se puede obtener automáticamente la alicuota para la ' - 'fecha %s. Por favor, ingrese la misma manualmente ' - 'en el partner.' % date) - + # Verificamos si el par_cod no es para los recien inscriptos, que vienen con fecha "0000-00-00" + if dict_alic.get("CRD_PAR_CODIGO") != 'NUE_INS': + # Verificar que el comprobante tenga fecha dentro de la vigencia + from_date_date = fields.Date.from_string(dict_alic.get("CRD_FECHA_INICIO")) + to_date_date = fields.Date.from_string(dict_alic.get("CRD_FECHA_FIN")) + if not (from_date_date <= date_date < to_date_date): + raise UserError( + 'No se puede obtener automáticamente la alicuota para la ' + 'fecha %s. Por favor, ingrese la misma manualmente ' + 'en el partner.' % date) data = { 'alicuota_percepcion': alicuota_percepcion, 'alicuota_retencion': alicuota_retencion,