[FIX] account: tour had wrong taxes and was too fast

Added a saveForm to wait for the compute/onchange to proc on the save
Added a tax, to be independent of localizations
Changed the product, to have a product with an amount that won't be
impacted by difference of default decimal place from localizations.

Fixes runbot error 22093

closes odoo/odoo#126883

X-original-commit: 2678f490648f81488c8635f2ebc01591935a48f1
Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
Gauthier Wala (gawa)
2023-06-30 01:33:10 +02:00
parent 59cf3c9e7c
commit f15134fa7d
2 changed files with 30 additions and 16 deletions
@@ -48,17 +48,18 @@ registry.category("web_tour.tours").add('account_tax_group', {
{
content: "Type item",
trigger: 'div[name="invoice_line_ids"] .o_selected_row .o_list_many2one[name="product_id"] input',
run: "text Large Desk",
run: "text Corner Desk Right Sit",
},
{
content: "Valid item",
trigger: '.ui-menu-item-wrapper:contains("Large Desk")',
trigger: '.ui-menu-item-wrapper:contains("Corner Desk Right Sit")',
},
// Save account.move
{
content: "Save the account move",
trigger: '.o_form_button_save',
},
...stepUtils.saveForm(),
// Edit tax group amount
{
content: "Edit tax group amount",
@@ -76,7 +77,7 @@ registry.category("web_tour.tours").add('account_tax_group', {
// Check new value for total (with modified tax_group_amount).
{
content: "Valid total amount",
trigger: 'span[name="amount_total"]:contains("1,499.00")',
trigger: 'span[name="amount_total"]:contains("800")',
},
// Modify the quantity of the object
{
@@ -102,10 +103,11 @@ registry.category("web_tour.tours").add('account_tax_group', {
content: "Save the account move",
trigger: '.o_form_button_save',
},
...stepUtils.saveForm(),
// Check new tax group value
{
content: "Check new value of tax group",
trigger: '.o_tax_group_amount_value:contains("389.70")',
trigger: '.o_tax_group_amount_value:contains("120")',
},
{
content: "Edit tax value",
@@ -114,7 +116,7 @@ registry.category("web_tour.tours").add('account_tax_group', {
},
{
content: "Check new value of total",
trigger: '.oe_subtotal_footer_separator:contains("2,600.00")',
trigger: '.oe_subtotal_footer_separator:contains("1,202")',
},
{
content: "Discard changes",
@@ -122,6 +124,6 @@ registry.category("web_tour.tours").add('account_tax_group', {
},
{
content: "Check tax value is reset",
trigger: '.o_tax_group_amount_value:contains("389.70")',
trigger: '.o_tax_group_amount_value:contains("120")',
},
]});
+22 -10
View File
@@ -7,6 +7,20 @@ import odoo.tests
@odoo.tests.tagged('post_install_l10n', 'post_install', '-at_install')
class TestUi(odoo.tests.HttpCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
all_moves = cls.env['account.move'].search([('move_type', '!=', 'entry')])
all_moves.button_draft()
all_moves.with_context(force_delete=True).unlink()
# In case of latam impacting multiple countries, disable the required fields manually.
if 'l10n_latam_use_documents' in cls.env['account.journal']._fields:
cls.env['account.journal']\
.search([('company_id', '=', cls.env.company.id), ('type', '=', 'purchase')])\
.write({'l10n_latam_use_documents': False})
def test_01_account_tour(self):
# Reset country and fiscal country, so that fields added by localizations are
# hidden and non-required, and don't make the tour crash.
@@ -22,18 +36,16 @@ class TestUi(odoo.tests.HttpCase):
account_with_taxes.write({
'tax_ids': [Command.clear()],
})
# This tour doesn't work with demo data on runbot
all_moves = self.env['account.move'].search([('move_type', '!=', 'entry')])
all_moves.button_draft()
all_moves.with_context(force_delete=True).unlink()
# In case of latam impacting multiple countries, disable the required fields manually.
if 'l10n_latam_use_documents' in self.env['account.journal']._fields:
self.env['account.journal']\
.search([('company_id', '=', self.env.company.id), ('type', '=', 'sale')])\
.write({'l10n_latam_use_documents': False})
self.start_tour("/web", 'account_tour', login="admin")
def test_01_account_tax_groups_tour(self):
product = self.env.ref('product.product_product_5')
new_tax = self.env['account.tax'].create({
'name': '10% Tour Tax',
'type_tax_use': 'purchase',
'amount_type': 'percent',
'amount': 10,
})
product.supplier_taxes_id = new_tax
self.start_tour("/web", 'account_tax_group', login="admin")