From 9e6d8bf8adf41d3b6011e7d4ff933ef1c80d32d7 Mon Sep 17 00:00:00 2001
From: "diego.barreto" <diego.barreto@eynes.com.ar>
Date: Tue, 2 Jul 2024 14:52:39 -0300
Subject: [PATCH 1/2] [FIX][T4850] change 'fechaEmision' in the AFIP request

---
 models/ws_caea_code.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/models/ws_caea_code.py b/models/ws_caea_code.py
index 3c10131..ae3a133 100644
--- a/models/ws_caea_code.py
+++ b/models/ws_caea_code.py
@@ -676,6 +676,7 @@ class WsCaeaCode(models.Model):
         por cada factura
         """
         now = date.today()
+        import wdb; wdb.set_trace()
         if now <= self.date_limit_report:
             # Informar Comprobante CAEA
             ws = self.config_id._get_wsmtxca()
-- 
GitLab


From 904a4470028c23c38be28875d2dfdcc224fe3574 Mon Sep 17 00:00:00 2001
From: "diego.barreto" <diego.barreto@eynes.com.ar>
Date: Tue, 2 Jul 2024 15:02:41 -0300
Subject: [PATCH 2/2] [FIX][T4850] fix date format, remove debugger

---
 models/ws_caea_code.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/models/ws_caea_code.py b/models/ws_caea_code.py
index ae3a133..fb87f6e 100644
--- a/models/ws_caea_code.py
+++ b/models/ws_caea_code.py
@@ -313,8 +313,7 @@ class WsCaeaCode(models.Model):
 
         env_curr_caea = self.env['caea.currency.codes']
         code_curr = env_curr_caea.get_cod(invoice.currency_id)
-        now = datetime.now()
-        now_string = "%s-%s-%s" % (now.strftime("%Y"), now.strftime("%m"), now.strftime("%d"))
+        exit_date = invoice.date_invoice.strftime('%Y-%m-%d')
         voucher_type = invoice._get_voucher_type()
         next_number = self.get_next_caea_voucher_number(invoice=invoice)
         # Save voucher number
@@ -325,7 +324,7 @@ class WsCaeaCode(models.Model):
             'codigoTipoComprobante': voucher_type,
             'numeroPuntoVenta': int(invoice.pos_ar_id.name),
             'numeroComprobante': next_number,
-            'fechaEmision': now_string,
+            'fechaEmision': exit_date,
             'codigoTipoAutorizacion': 'A',
             'codigoAutorizacion': int(invoice.caea),
             'fechaVencimiento': str(invoice.date_to),
@@ -676,7 +675,6 @@ class WsCaeaCode(models.Model):
         por cada factura
         """
         now = date.today()
-        import wdb; wdb.set_trace()
         if now <= self.date_limit_report:
             # Informar Comprobante CAEA
             ws = self.config_id._get_wsmtxca()
-- 
GitLab