Skip to content

Commit

Permalink
[ADD] l10n_ar_edi_ux: Add test_update_from_afip
Browse files Browse the repository at this point in the history
  • Loading branch information
mem-adhoc committed Sep 24, 2024
1 parent 634354e commit 03213b6
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions l10n_ar_edi_ux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
##############################################################################
from . import models
from . import wizards
from . import tests
from .monkey_patches import *
1 change: 1 addition & 0 deletions l10n_ar_edi_ux/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_update_from_afip
65 changes: 65 additions & 0 deletions l10n_ar_edi_ux/tests/test_update_from_afip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# from odoo.tests import HttpCase, tagged

import odoo.tests.common as common
from odoo import fields, Command

class TestUpdateFromAfip(common.TransactionCase):

def setUp(self):
super().setUp()
self.today = fields.Date.today()
self.contacto_monotributo = self.env['res.partner'].create({
'name': 'Partner Monotributo',
'street': 'Calle Falsa 123',
'vat': '20221064233',
'city': 'Rosario',
'zip': '2000',
'l10n_latam_identification_type_id': self.env.ref('l10n_ar.it_cuit').id,
'state_id': self.env.ref('base.state_ar_s').id,
})
self.contacto_Responsableinscripto = self.env['res.partner'].create({
'name': 'Partner Responsable Inscripto',
'street': 'Calle Falsa 123',
'vat': '20188027963',
'city': 'Rosario',
'zip': '2000',
'l10n_latam_identification_type_id': self.env.ref('l10n_ar.it_cuit').id,
'state_id': self.env.ref('base.state_ar_s').id,
})

def testmonotributo(self):
"""Actualizamos un contacto del tipo monotributo"""

"""Chequeamos que no hay actividades ni impuestos creados"""
self.assertEqual(self.env['afip.activity'], self.env['afip.activity'].search([]), "Activities are not being created.")
self.assertEqual(self.env['afip.tax'], self.env['afip.tax'].search([]), "Taxes are not being created.")

contacto = self.contacto_monotributo
res_id = contacto.button_update_partner_data_from_afip()['res_id']
wiz = self.env['res.partner.update.from.padron.wizard'].browse(res_id)
wiz.update_selection()


self.assertEqual(contacto.name, 'Marjorier, Lamara', "Name after the update from afip must change")
"""Chequeamos que las actividades e impuestos se hayan creado con la actualizacion"""
self.assertNotEqual(contacto.actividades_padron, False, "Activities are not being created.")
self.assertNotEqual(contacto.impuestos_padron, False, "Taxes are not being created.")

def testresponsableinscripto(self):
"""Actualizamos un contacto del tipo Responsable Inscripto"""

"""Chequeamos que no hay actividades ni impuestos creados"""
self.assertEqual(self.env['afip.activity'], self.env['afip.activity'].search([]), "Activities are not being created.")
self.assertEqual(self.env['afip.tax'], self.env['afip.tax'].search([]), "Taxes are not being created.")

contacto = self.contacto_Responsableinscripto
res_id = contacto.button_update_partner_data_from_afip()['res_id']
wiz = self.env['res.partner.update.from.padron.wizard'].browse(res_id)
wiz.update_selection()

self.assertEqual(contacto.name, 'Paniagua Koler, Venancio', "Name after the update from afip must change")
"""Chequeamos que las actividades e impuestos se hayan creado con la actualizacion"""
self.assertNotEqual(contacto.actividades_padron, False, "Activities are not being created.")
self.assertNotEqual(contacto.impuestos_padron, False, "Taxes are not being created.")

0 comments on commit 03213b6

Please sign in to comment.