@@ -1345,3 +1345,59 @@ def misiones_files_values(self, move_lines):
1345
1345
'txt_filename' : ('Retenciones ' if payment else 'Percepciones ' ) + 'Misiones.txt' ,
1346
1346
'txt_content' : content ,
1347
1347
}]
1348
+
1349
+ def retenciones_iva_files_values (self , move_lines ):
1350
+ """ Implementado segun especificación indicada en ticket 54274."""
1351
+ self .ensure_one ()
1352
+ content = ''
1353
+ for line in move_lines .sorted (key = lambda r : (r .date , r .id )):
1354
+ payment = line .payment_id
1355
+ if payment :
1356
+ # regimen (long 3)
1357
+ codigo_regimen = payment .tax_withholding_id .codigo_regimen
1358
+ if not codigo_regimen :
1359
+ raise ValidationError (_ ('No hay código de régimen en la configuración del impuesto "%s"' ) % (
1360
+ payment .tax_withholding_id .name ))
1361
+ if len (codigo_regimen ) < 3 :
1362
+ raise ValidationError (_ ('El código de régimen tiene que tener 3 dígitos en la configuración del impuesto "%s"' ) % (payment .tax_withholding_id .name ))
1363
+ content += codigo_regimen [:3 ]
1364
+
1365
+ # cuit agente (long 11)
1366
+ content += payment .partner_id .ensure_vat ()
1367
+
1368
+ # fecha retención (long 10)
1369
+ content += fields .Date .from_string (payment .date ).strftime ('%d/%m/%Y' )
1370
+
1371
+ # número comprobante (long 16)
1372
+ content += re .sub ('[^0-9\.-]' , '' , payment .name )[1 :].ljust (16 )
1373
+
1374
+ # importe retención (long 16)
1375
+ content += '%16.2f' % payment .amount
1376
+ content += '\r \n '
1377
+ elif line .move_id .is_invoice ():
1378
+ # regimen (long 3)
1379
+ codigo_regimen = line .tax_line_id .codigo_regimen
1380
+ if not codigo_regimen :
1381
+ raise ValidationError (_ ('No hay código de régimen en la configuración del impuesto "%s"' ) % (
1382
+ line .tax_withholding_id .name ))
1383
+ if len (codigo_regimen ) < 3 :
1384
+ raise ValidationError (_ ('El código de régimen tiene que tener 3 dígitos en la configuración del impuesto "%s"' ) % (line .tax_withholding_id .name ))
1385
+ content += codigo_regimen [:3 ]
1386
+
1387
+ # cuit agente (long 11)
1388
+ content += line .move_id .partner_id .ensure_vat ()
1389
+
1390
+ # fecha retención (long 10)
1391
+ content += fields .Date .from_string (line .move_id .invoice_date ).strftime ('%d/%m/%Y' )
1392
+
1393
+ # número comprobante (long 16)
1394
+ content += line .move_id .l10n_latam_document_number .ljust (16 )
1395
+
1396
+ # importe retención (long 16)
1397
+ content += '%16.2f' % line .balance
1398
+ content += '\r \n '
1399
+
1400
+ return [{
1401
+ 'txt_filename' : ('Retenciones' if payment else 'Percepciones' ) + '_iva.txt' ,
1402
+ 'txt_content' : content ,
1403
+ }]
0 commit comments