diff --git a/account_invoice_change/__manifest__.py b/account_invoice_change/__manifest__.py index 952b2e59..8d0a8503 100644 --- a/account_invoice_change/__manifest__.py +++ b/account_invoice_change/__manifest__.py @@ -1,7 +1,7 @@ { 'name': 'Account Invoice Change', 'author': 'Hibou Corp. ', - 'version': '13.0.1.0.0', + 'version': '16.0.1.0.0', 'category': 'Accounting', 'sequence': 95, 'summary': 'Technical foundation for changing invoices.', @@ -23,6 +23,7 @@ the invoice is currently in. 'account', ], 'data': [ + 'security/ir.model.access.csv', 'wizard/invoice_change_views.xml', ], 'installable': True, diff --git a/account_invoice_change/security/ir.model.access.csv b/account_invoice_change/security/ir.model.access.csv new file mode 100644 index 00000000..7a03cada --- /dev/null +++ b/account_invoice_change/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +account_invoice_change.access_account_invoice_change,access_account_invoice_change,account_invoice_change.model_account_invoice_change,base.group_user,1,1,1,1 diff --git a/account_invoice_change/tests/test_invoice_change.py b/account_invoice_change/tests/test_invoice_change.py index e2c362bd..e6191dbc 100644 --- a/account_invoice_change/tests/test_invoice_change.py +++ b/account_invoice_change/tests/test_invoice_change.py @@ -1,36 +1,35 @@ -from odoo.addons.account.tests.account_test_users import AccountTestUsers +from odoo.addons.account.tests.common import AccountTestInvoicingCommon +from odoo.tests import tagged from odoo import fields +from odoo import Command -class TestInvoiceChange(AccountTestUsers): +@tagged('post_install', '-at_install') +class TestInvoiceChange(AccountTestInvoicingCommon): def test_invoice_change_basic(self): self.account_invoice_obj = self.env['account.move'] self.payment_term = self.env.ref('account.account_payment_term_advance') self.journalrec = self.env['account.journal'].search([('type', '=', 'sale')])[0] self.partner3 = self.env.ref('base.res_partner_3') - self.invoice_basic = self.account_invoice_obj.with_user(self.account_user).create({ - 'type': 'out_invoice', + self.invoice_basic = self.env['account.move'].create([{ + 'move_type': 'out_invoice', 'name': "Test Customer Invoice", 'invoice_payment_term_id': self.payment_term.id, 'journal_id': self.journalrec.id, 'partner_id': self.partner3.id, - # account_id=self.account_rec1_id.id, - 'line_ids': [(0, 0, { - 'product_id': self.env.ref('product.product_product_5').id, + 'line_ids':[Command.create({ + 'product_id': self.product_a.id, 'quantity': 10.0, - 'account_id': self.env['account.account'].search( - [('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id, - 'name': 'product test 5', 'price_unit': 100.00, })], - }) + }]) self.assertEqual(self.invoice_basic.state, 'draft') self.invoice_basic.action_post() self.assertEqual(self.invoice_basic.state, 'posted') self.assertEqual(self.invoice_basic.date, fields.Date.today()) self.assertEqual(self.invoice_basic.invoice_date, fields.Date.today()) - self.assertEqual(self.invoice_basic.invoice_user_id, self.account_user) + # self.assertEqual(self.invoice_basic.invoice_user_id, self.account_user) self.assertEqual(self.invoice_basic.line_ids[0].date, fields.Date.today()) ctx = {'active_model': 'account.move', 'active_ids': [self.invoice_basic.id]} diff --git a/account_invoice_change/wizard/invoice_change_views.xml b/account_invoice_change/wizard/invoice_change_views.xml index 5e233688..40c73f51 100644 --- a/account_invoice_change/wizard/invoice_change_views.xml +++ b/account_invoice_change/wizard/invoice_change_views.xml @@ -39,7 +39,7 @@