Skip to content
Snippets Groups Projects
Commit a7bddfd1 authored by Julien Carion (juca)'s avatar Julien Carion (juca)
Browse files

[FIX] account: fix vendor bills tax discard


This commit fixes the object reference issue which was linked to the
TaxTotals Component computations. The issue was that discarding changes
on the tax field of a vendor bill wouldn't roll back the field's value
visually while the record would still have correctly updated values.
This issue originates from the fact that operations were made to compute
the taxes in the component but these would affect the server data as
well since the object reference between the local data and the server
data was the same. This means that the discard operation would bring
the displayed value back to the server data's one which has been
modified by the computations so it would not work. The reference to the
server data is now separated from the local one so that the bug won't
appear anymore.

opw-3285209

closes odoo/odoo#123278

Signed-off-by: default avatarMathieu Duckerts-Antoine <dam@odoo.com>
parent 2ad50424
Branches
Tags
No related merge requests found
......@@ -143,7 +143,7 @@ export class TaxTotalsComponent extends Component {
}
formatData(props) {
let totals = props.value;
let totals = structuredClone(props.value);
const currencyFmtOpts = { currencyId: props.record.data.currency_id && props.record.data.currency_id[0] };
let amount_untaxed = totals.amount_untaxed;
......
......@@ -19,11 +19,11 @@ tour.register('account_tax_group', {
},
{
content: "Go to Vendors",
trigger: 'a:contains("Vendors")',
trigger: 'span:contains("Vendors")',
},
{
content: "Go to Bills",
trigger: 'span:contains("Bills")',
trigger: 'a:contains("Bills")',
},
{
extra_trigger: '.breadcrumb:contains("Bills")',
......@@ -33,7 +33,7 @@ tour.register('account_tax_group', {
// Set a vendor
{
content: "Add vendor",
trigger: 'div.o_field_widget.o_field_many2one[name="partner_id"] div input',
trigger: 'div.o_field_widget.o_field_res_partner_many2one[name="partner_id"] div input',
run: 'text Azure Interior',
},
{
......@@ -47,11 +47,11 @@ tour.register('account_tax_group', {
},
{
content: "Select input",
trigger: 'div[name="invoice_line_ids"] .o_list_view .o_selected_row .o_list_many2one:first input',
trigger: 'div[name="invoice_line_ids"] .o_selected_row .o_list_many2one[name="product_id"] input',
},
{
content: "Type item",
trigger: 'div[name="invoice_line_ids"] .o_list_view .o_selected_row .o_list_many2one:first input',
trigger: 'div[name="invoice_line_ids"] .o_selected_row .o_list_many2one[name="product_id"] input',
run: "text Large Desk",
},
{
......@@ -85,16 +85,16 @@ tour.register('account_tax_group', {
// Modify the quantity of the object
{
content: "Select item quantity",
trigger: 'div[name="invoice_line_ids"] .o_list_view tbody tr.o_data_row .o_list_number[title="1.00"]',
trigger: 'div[name="invoice_line_ids"] tbody tr.o_data_row .o_list_number[name="quantity"]',
},
{
content: "Change item quantity",
trigger: 'div[name="invoice_line_ids"] .o_list_view tbody tr.o_data_row .o_list_number[title="1.00"] input',
trigger: 'div[name="invoice_line_ids"] tbody tr.o_data_row .o_list_number[name="quantity"] input',
run: 'text 2',
},
{
content: "Valid the new value",
trigger: 'div[name="invoice_line_ids"] .o_list_view tbody tr.o_data_row .o_list_number[title="1.00"] input',
trigger: 'div[name="invoice_line_ids"] tbody tr.o_data_row .o_list_number[name="quantity"] input',
run: function (actions) {
let keydownEvent = jQuery.Event('keydown');
keydownEvent.which = 13;
......@@ -111,4 +111,21 @@ tour.register('account_tax_group', {
content: "Check new value of tax group",
trigger: '.o_tax_group_amount_value:contains("389.70")',
},
{
content: "Edit tax value",
trigger: '.o_tax_group_edit_input input',
run: 'text 2'
},
{
content: "Check new value of total",
trigger: '.oe_subtotal_footer_separator:contains("2,600.00")',
},
{
content: "Discard changes",
trigger: '.o_form_button_cancel',
},
{
content: "Check tax value is reset",
trigger: '.o_tax_group_amount_value:contains("389.70")',
},
]);
......@@ -34,3 +34,6 @@ class TestUi(odoo.tests.HttpCase):
.write({'l10n_latam_use_documents': False})
self.start_tour("/web", 'account_tour', login="admin")
def test_01_account_tax_groups_tour(self):
self.start_tour("/web", 'account_tax_group', login="admin")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment