From e19221c533f37041467891a81ea94dea4cbefcc1 Mon Sep 17 00:00:00 2001 From: Pablo Montenegro Date: Thu, 11 Jul 2024 10:50:50 -0300 Subject: [PATCH] =?UTF-8?q?[IMP]=20l10n=5Far=5Fedi=5Fux:=20uso=20certifica?= =?UTF-8?q?do=20digital=20en=20update=20from=20afip=20Si=20se=20quiere=20h?= =?UTF-8?q?acer=20update=20from=20afip=20posicionado=20en=20una=20compa?= =?UTF-8?q?=C3=B1=C3=ADa=20con=20certificado=20digital=20vencido=20o=20sin?= =?UTF-8?q?=20certificado=20digital=20entonces=20no=20usa=20dicho=20certif?= =?UTF-8?q?icado=20y=20busca=20el=20certificado=20de=20la=20primer=20compa?= =?UTF-8?q?=C3=B1=C3=ADa=20que=20se=20encuentre=20y=20que=20est=C3=A9=20vi?= =?UTF-8?q?gente=20(no=20expirado)=20el=20certificado=20de=20dicha=20compa?= =?UTF-8?q?=C3=B1=C3=ADa.=20Esto=20es=20similar=20a=20lo=20que=20hacemos?= =?UTF-8?q?=20en=20https://github.com/ingadhoc/odoo-argentina-ee/blob/16.0?= =?UTF-8?q?/l10n=5Far=5Fcurrency=5Fupdate/models/res=5Fcompany.py#L75:L76?= =?UTF-8?q?=20Tarea:=2041246?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_ar_edi_ux/models/res_partner.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/l10n_ar_edi_ux/models/res_partner.py b/l10n_ar_edi_ux/models/res_partner.py index 24eb7e49..e03f9f82 100644 --- a/l10n_ar_edi_ux/models/res_partner.py +++ b/l10n_ar_edi_ux/models/res_partner.py @@ -30,10 +30,11 @@ def get_data_from_padron_afip(self): vat = self.ensure_vat() # if there is certificate for current company use that one, if not use the company with first certificate found - company = self.env.company if self.env.company.sudo().l10n_ar_afip_ws_crt else self.env['res.company'].sudo().search( - [('l10n_ar_afip_ws_crt', '!=', False)], limit=1) + today = fields.Date.context_today(self.with_context(tz='America/Argentina/Buenos_Aires')) + company = self.env.company if self.env.company.sudo().l10n_ar_afip_ws_crt and self.env.company.sudo().l10n_ar_crt_exp_date > today else self.env['res.company'].sudo().search( + [('l10n_ar_afip_ws_crt', '!=', False), ('l10n_ar_crt_exp_date', '>', today)], limit=1) if not company: - raise UserError(_('Please configure an AFIP Certificate in order to continue')) + raise UserError(_('Please configure an active AFIP Certificate in order to continue')) client, auth = company._l10n_ar_get_connection('ws_sr_constancia_inscripcion')._get_client() error_msg = _(