[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#125304 X-original-commit: 9178c96f5788989c38fbb335ea79fc6ea8698131 Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com> Signed-off-by: Julien Carion (juca) <juca@odoo.com>
This commit is contained in:
@@ -143,7 +143,7 @@ export class TaxTotalsComponent extends Component {
|
||||
}
|
||||
|
||||
formatData(props) {
|
||||
let totals = props.record.data[this.props.name];
|
||||
let totals = structuredClone(props.record.data[this.props.name]);
|
||||
const currencyFmtOpts = { currencyId: props.record.data.currency_id && props.record.data.currency_id[0] };
|
||||
|
||||
let amount_untaxed = totals.amount_untaxed;
|
||||
|
||||
@@ -20,21 +20,21 @@ registry.category("web_tour.tours").add('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")',
|
||||
extra_trigger: '.o_breadcrumb .text-truncate:contains("Bills")',
|
||||
content: "Create new bill",
|
||||
trigger: '.o_list_button_add',
|
||||
trigger: '.o_control_panel_main_buttons .d-none .o_list_button_add',
|
||||
},
|
||||
// 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',
|
||||
},
|
||||
{
|
||||
@@ -48,11 +48,11 @@ registry.category("web_tour.tours").add('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",
|
||||
},
|
||||
{
|
||||
@@ -86,16 +86,16 @@ registry.category("web_tour.tours").add('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;
|
||||
@@ -112,4 +112,21 @@ registry.category("web_tour.tours").add('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")
|
||||
|
||||
Reference in New Issue
Block a user