|
| 1 | +from odoo.tests import common |
| 2 | + |
| 3 | + |
| 4 | +class TestL10nReportParams(common.TransactionCase): |
| 5 | + |
| 6 | + # Creamos este test para los formatos de parametros de reporte |
| 7 | + |
| 8 | + def setUp(self): |
| 9 | + |
| 10 | + company_uy = self.env.ref('l10n_uy_account.company_uy') |
| 11 | + lang_es = self.env['res.lang'].search([['code', '=', 'en_AR']]) |
| 12 | + lang_en = self.env['res.lang'].search([['code', '=', 'en_US']]) |
| 13 | + content = """ |
| 14 | + Estimated Net Weight: 25.995,00 Kg |
| 15 | + Estimated Gross Weight: 26.774,850 Kg |
| 16 | + In 1 x 40 reef |
| 17 | + BL Nº: TBI |
| 18 | + SHIPPER / MANUFACTURER: C.VALE - COOPERATIVA AGROINDUSTRIAL (SIF 3300) |
| 19 | + AV. ARIOSVALDO BITENCOURT, 2000 CENTRO 85950000, PALOTINA - BRASIL |
| 20 | + MEANS OF TRANSPORTATION: Sea |
| 21 | + ORIGIN: Brazil |
| 22 | + PORT OF LOADING: Paranagua - Brazil |
| 23 | + PORT OF DISCHARGE: Cebu - Philippines |
| 24 | + SHIPMENT DATE: September, 2024 |
| 25 | + SALE TERMS: CNF (COST AND FREIGHT) Insurance under responsibility of the buyer |
| 26 | + TERMS OF PAYMENT: 100% TT Against copy of original documents |
| 27 | + """ |
| 28 | + adenda = self.env['l10n.uy.adenda'].create({ |
| 29 | + 'name': 'Adenda Test pruebas', |
| 30 | + 'legend_type': 'adenda', |
| 31 | + 'company_id': company_uy.id, |
| 32 | + 'apply_on': 'account.move', |
| 33 | + 'content': content |
| 34 | + }) |
| 35 | + partner_en = self.env['res.partner'].create({ |
| 36 | + 'name': 'Partner Test Adenda EN', |
| 37 | + 'lang': lang_en.code |
| 38 | + }) |
| 39 | + partner_es = self.env['res.partner'].create({ |
| 40 | + 'name': 'Partner Test Adenda ES', |
| 41 | + 'lang': lang_es.code |
| 42 | + }) |
| 43 | + move = self.env['account.move'].create({ |
| 44 | + 'move_type': 'out_invoice', |
| 45 | + 'l10n_latam_document_type_id': self.env.ref('l10n_uy_account.dc_e_ticket').id, |
| 46 | + 'partner_id': partner_en.id, |
| 47 | + 'invoice_date': '2024-01-21', |
| 48 | + 'date': '2024-01-21', |
| 49 | + }) |
| 50 | + move_2 = self.env['account.move'].create({ |
| 51 | + 'move_type': 'out_invoice', |
| 52 | + 'l10n_latam_document_type_id': self.env.ref('l10n_uy_account.dc_e_ticket').id, |
| 53 | + 'partner_id': partner_es.id, |
| 54 | + 'invoice_date': '2024-01-21', |
| 55 | + 'date': '2024-01-21', |
| 56 | + }) |
| 57 | + |
| 58 | + def test_reportparams_adenda_test(self): |
| 59 | + |
| 60 | + nombreParametros, valoresParametros = self.move_2._get_report_params() |
| 61 | + self.assertEqual(nombreParametros, ['adenda']) |
| 62 | + self.assertEqual(valoresParametros, ['true']) |
| 63 | + |
| 64 | + nombreParametros, valoresParametros = self.move._get_report_params() |
| 65 | + |
| 66 | + self.assertEqual(nombreParametros, ['adenda','reporte']) |
| 67 | + self.assertEqual(valoresParametros, ['true','ingles']) |
0 commit comments