Skip to content

Commit

Permalink
[ADD] account_ux: Account ux unitary test
Browse files Browse the repository at this point in the history
closes #553

Signed-off-by: rov-adhoc <[email protected]>
  • Loading branch information
feg-adhoc committed Sep 20, 2024
1 parent 199e852 commit eb53ba9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions account_ux/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_account_ux
46 changes: 46 additions & 0 deletions account_ux/tests/test_account_ux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import odoo.tests.common as common
from odoo import Command, fields


class TestAccountUXChangeCurrency(common.TransactionCase):

def setUp(self):
super().setUp()
self.today = fields.Date.today()
self.first_company = self.env['res.company'].search([], limit=1)
self.partner_ri = self.env['res.partner'].search([], limit=1)

self.currency_usd = self.env['res.currency'].search([('name', '=', 'USD')])
self.currency_ars = self.env['res.currency'].search([('name', '=', 'ARS'), ('active', 'in', [False])])
self.currency_ars.active = True

self.first_company_journal_usd = self.env['account.journal'].search([('company_id', '=', self.first_company.id), ('type', '=', 'sale')], limit=1)
self.first_company_journal_ars = self.env['account.journal'].create({
'name': 'ARS sale journal',
'company_id': self.first_company.id,
'type': 'sale',
'currency_id': self.currency_ars.id,
'code': 'ARS'
})

def test_account_ux_change_currency(self):
invoice = self.env['account.move'].create({
'partner_id': self.partner_ri.id,
'date': self.today,
'move_type': 'out_invoice',
'journal_id': self.first_company_journal_usd.id,
'company_id': self.first_company.id,
'invoice_line_ids': [
Command.create({
'product_id': self.env.ref('product.product_product_16').id,
'quantity': 1,
'price_unit': 1000,
}),
],
})
invoice.write({
'journal_id': self.first_company_journal_ars.id
})
invoice.action_post()

self.assertEqual(invoice.currency_id, self.first_company_journal_ars.currency_id, "La moneda de la factura no esta siendo modificada al cambiar el diario.")

0 comments on commit eb53ba9

Please sign in to comment.