19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:30:07 +01:00
parent ba20ce7443
commit 768b70e05e
2357 changed files with 1057103 additions and 712486 deletions

View file

@ -1,19 +1,23 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import odoo.tests
from odoo import Command, fields
from odoo import Command
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.addons.account.tests.common import AccountTestInvoicingHttpCommon
@odoo.tests.tagged('post_install_l10n', 'post_install', '-at_install')
class TestUi(AccountTestInvoicingCommon, odoo.tests.HttpCase):
class TestUi(AccountTestInvoicingHttpCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
all_moves = cls.env['account.move'].search([('move_type', '!=', 'entry')])
all_moves = all_moves.filtered(lambda m: not m.inalterable_hash and m.state in ('posted', 'cancel'))
# This field is only present in account_accountant
if 'deferred_move_ids' in all_moves._fields:
all_moves = all_moves.filtered(lambda m: not m.deferred_move_ids)
all_moves.button_draft()
all_moves.with_context(force_delete=True).unlink()
@ -31,18 +35,34 @@ class TestUi(AccountTestInvoicingCommon, odoo.tests.HttpCase):
self.env.ref('base.user_admin').write({
'company_id': self.env.company.id,
'company_ids': [(4, self.env.company.id)],
'email': 'mitchell.admin@example.com',
})
self.env.company.write({
'country_id': None, # Also resets account_fiscal_country_id
'account_sale_tax_id': None,
'account_purchase_tax_id': None,
'external_report_layout_id': self.env.ref('web.external_layout_standard').id,
})
account_with_taxes = self.env['account.account'].search([('tax_ids', '!=', False), ('company_id', '=', self.env.company.id)])
account_with_taxes = self.env['account.account'].search([('tax_ids', '!=', False), ('company_ids', '=', self.env.company.id)])
account_with_taxes.write({
'tax_ids': [Command.clear()],
})
self.start_tour("/web", 'account_tour', login="admin")
# Remove all posted invoices to enable 'create first invoice' button
invoices = self.env['account.move'].search([('company_id', '=', self.env.company.id), ('move_type', '=', 'out_invoice')])
for invoice in invoices:
if invoice.state in ('cancel', 'posted'):
invoice.button_draft()
invoices.unlink()
# remove all entries in the miscellaneous journal to test the onboarding
self.env['account.move'].search([
('journal_id.type', '=', 'general'),
('state', '=', 'draft'),
]).unlink()
self.start_tour("/odoo", 'account_tour', login="admin")
def test_01_account_tax_groups_tour(self):
self.env.ref('base.user_admin').write({
@ -57,7 +77,7 @@ class TestUi(AccountTestInvoicingCommon, odoo.tests.HttpCase):
'name': 'Account Tax Group Product',
'standard_price': 600.0,
'list_price': 147.0,
'detailed_type': 'consu',
'type': 'consu',
})
new_tax = self.env['account.tax'].create({
'name': '10% Tour Tax',
@ -67,4 +87,32 @@ class TestUi(AccountTestInvoicingCommon, odoo.tests.HttpCase):
})
product.supplier_taxes_id = new_tax
self.start_tour("/web", 'account_tax_group', login="admin")
self.start_tour("/odoo", 'account_tax_group', login="admin")
def test_use_product_catalog_on_invoice(self):
self.product.write({
'is_favorite': True,
'default_code': '0',
})
self.start_tour("/odoo/customer-invoices/new", 'test_use_product_catalog_on_invoice', login="admin")
def test_deductible_amount_column(self):
self.assertFalse(self.env.user.has_group('account.group_partial_purchase_deductibility'))
partner = self.env['res.partner'].create({'name': "Test Partner", 'email': "test@test.odoo.com"})
move = self.env['account.move'].create({
'move_type': 'in_invoice',
'partner_id': partner.id,
'invoice_date': fields.Date.today(),
'line_ids': [Command.create({'name': "T-shirt", 'deductible_amount': 50.0})],
})
move.action_post()
self.assertTrue(self.env.user.has_group('account.group_partial_purchase_deductibility'))
self.start_tour("/odoo/vendor-bills/new", 'deductible_amount_column', login=self.env.user.login)
def test_add_section_from_product_catalog_on_invoice_tour(self):
self.product.write({'is_favorite': True})
self.start_tour(
'/odoo/customer-invoices/new',
'test_add_section_from_product_catalog_on_invoice',
login='admin',
)