-
-
Notifications
You must be signed in to change notification settings - Fork 681
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] test converted from yaml to unittest
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_account_force_number |
46 changes: 46 additions & 0 deletions
46
account_invoice_force_number/tests/test_account_force_number.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2016 Davide Corio - davidecorio.com | ||
# Copyright 2017 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from openerp.tests.common import TransactionCase | ||
|
||
|
||
class TestAccountForceNumber(TransactionCase): | ||
|
||
def setUp(self): | ||
super(TestAccountForceNumber, self).setUp() | ||
|
||
def test_force_number(self): | ||
# in order to test the correct assignment of the internal_number | ||
# I create a customer invoice. | ||
invoice_vals = [ | ||
(0, 0, { | ||
'product_id': self.env.ref('product.product_product_3').id, | ||
'quantity': 1.0, | ||
'account_id': self.env['account.account'].search( | ||
[('user_type_id', '=', self.env.ref( | ||
'account.data_account_type_revenue').id)], | ||
limit=1).id, | ||
'name': '[PCSC234] PC Assemble SC234', | ||
'price_unit': 450.00 | ||
}) | ||
] | ||
|
||
invoice = self.env['account.invoice'].create({ | ||
'name': "Test Customer Invoice", | ||
'journal_id': self.env['account.journal'].search( | ||
[('type', '=', 'sale')])[0].id, | ||
'partner_id': self.env.ref('base.res_partner_12').id, | ||
'account_id': self.env['account.account'].search( | ||
[('user_type_id', '=', self.env.ref( | ||
'account.data_account_type_receivable').id)], | ||
limit=1).id, | ||
'invoice_line_ids': invoice_vals, | ||
}) | ||
# I set the force number | ||
invoice.move_name = '0001' | ||
# I validate the invoice | ||
invoice.action_invoice_open() | ||
|
||
# I check that the invoice number is the one we expect | ||
self.assertEqual(invoice.number, invoice.move_name, msg='Wrong number') |