Skip to content

Instantly share code, notes, and snippets.

@pablohmontenegro
pablohmontenegro / 43467_error_para_kathy_11122024
Created December 11, 2024 14:34
43467_error_para_kathy_11122024
2024-12-11 14:28:52,564 126 ERROR 18_43467_l10n_uy_edi_09122024 odoo.addons.l10n_uy_edi.tests.test_manual: ERROR: TestManual.test_120_uploaded_vendor_bill_with_line_fixed_discount
Traceback (most recent call last):
File "/home/odoo/custom/enterprise/l10n_uy_edi/tests/test_manual.py", line 224, in test_120_uploaded_vendor_bill_with_line_fixed_discount
new_bill = self._upload_document_on_journal(
File "/home/odoo/custom/enterprise/l10n_uy_edi/tests/common.py", line 221, in _upload_document_on_journal
action_vals = journal.create_document_from_attachment(attachment.ids)
File "/home/odoo/custom/enterprise/account_bank_statement_import/models/account_journal.py", line 31, in create_document_from_attachment
return super().create_document_from_attachment(attachment_ids)
File "/home/odoo/custom/odoo/addons/account/models/account_journal.py", line 977, in create_document_from_attachment
invoices = self._create_document_from_attachment(attachment_ids)
File "/home/odoo/src/odoo/odoo/http.py", line 2207, in __call__
response = request._serve_db()
File "/home/odoo/src/odoo/odoo/http.py", line 1783, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/home/odoo/src/odoo/odoo/service/model.py", line 133, in retrying
result = func()
File "/home/odoo/src/odoo/odoo/http.py", line 1810, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/home/odoo/src/odoo/odoo/http.py", line 2014, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
@pablohmontenegro
pablohmontenegro / listado_ndea_ecloudsolutions26112024_83470
Last active November 26, 2024 13:35
listado_ndea_ecloudsolutions26112024_83470
def get_pos_and_number(full_number):
"""
Para un numero nos fijamos si hay '-', si hay:
* mas de 1, entonces devolvemos error
* 1, entonces devolvemos las partes (solo parte númerica)
* 0, entonces devolvemos '0' y parte númerica del número que se pasó
"""
args = full_number.split('-')
if len(args) == 1:
# si no hay '-' tomamos punto de venta 0
@pablohmontenegro
pablohmontenegro / NC-B 00020-00001869
Created November 13, 2024 20:00
NC-B 00020-00001869
Número de factura 1869
* Concepto: 1
* DocTipo: 96
* DocNro: 22855204
* CbteDesde: 1869
* CbteHasta: 1869
* CbteFch: 20241108
* ImpTotal: 156000.0
* ImpTotConc:
* ImpNeto: 141176.47
@pablohmontenegro
pablohmontenegro / script por shell
Created November 13, 2024 19:00
script por shell
def get_pos_and_number(full_number):
"""
Para un numero nos fijamos si hay '-', si hay:
* mas de 1, entonces devolvemos error
* 1, entonces devolvemos las partes (solo parte númerica)
* 0, entonces devolvemos '0' y parte númerica del número que se pasó
"""
args = full_number.split('-')
if len(args) == 1:
@pablohmontenegro
pablohmontenegro / listado_nc
Created November 13, 2024 14:54
listado_nc
+---------------------+------------------------------+----------------+----------------+-------------+-------------------------------+
| Nombre | CbteDesde | invoice_date | CAE | Resultado | Fecha de Respuesta XML |
+=====================+==============================+================+================+=============+===============================+
| / | 1917 | 13/11/2024 | False | False | |
+---------------------+------------------------------+----------------+----------------+-------------+-------------------------------+
| NC-B 00020-00001915 | 1915 | 12/11/2024 | 74461934691639 | A | |
+---------------------+------------------------------+----------------+----------------+-------------+-------------------------------+
| NC-B 00020-00001914 | 1914 | 12/11/2024 | 7446193
@pablohmontenegro
pablohmontenegro / 18 - certificados de test - VERIFICAR
Created November 11, 2024 15:59
18 - certificados de test - VERIFICAR
from odoo.tools.misc import file_path
def prepare_for_test(self):
self = self.sudo()
companies_with_edi = self.env['account.journal'].search([('l10n_ar_afip_pos_system', 'in', ['RAW_MAW', 'FEEWS', 'BFEWS'])]).mapped('company_id')
for company in companies_with_edi:
import base64
import random
import logging
_logger = logging.getLogger(__name__)
_logger.info('Updating demo date for company %s' % (company.name))
@pablohmontenegro
pablohmontenegro / overlap de fechas
Created November 7, 2024 13:52
overlap de fechas
@api.constrains('tax_id', 'date_from', 'date_to')
def _check_date_overlap(self):
for record in self:
if record.date_from and record.date_to:
# Verificar que no haya superposición de fechas con otro registro
overlapping_records = self.search([
('tax_id', '=', record.tax_id.id),
('id', '!=', record.id), # Excluir el propio registro
('date_from', '<=', record.date_to),
('date_to', '>=', record.date_from)
@pablohmontenegro
pablohmontenegro / etree.tostring(response_610)
Created November 5, 2024 12:51
etree.tostring(response_610)
b'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
<u:Timestamp u:Id="_0">
<u:Created>2024-11-05T12:46:36.191Z</u:Created>
<u:Expires>2024-11-05T12:51:36.191Z</u:Expires>
</u:Timestamp>
</o:Security>
</s:Header>
@pablohmontenegro
pablohmontenegro / XmlCfeFirmado transformado
Created November 5, 2024 12:51
XmlCfeFirmado transformado
<XmlCfeFirmado>
<CFE xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
xmlns="http://cfe.dgi.gub.uy"></CFE>
<eFact>
<TmstFirma>2024-09-06T01:49:38-03:00</TmstFirma>
<Encabezado>
<IdDoc>
<TipoCFE>111</TipoCFE>
<Serie>A</Serie>