[FIX] l10n_in: Fix python compute taxes.

Problem
---------
During the conversion from XML to CSV, some python taxes were broken.

Objective
---------
The task consist in checking all python taxes and ensures it's working.

Solution
---------
Problem appears to be that the migration script from XML to CSV, removed
the '\n' in the python compute code, making things like
`result=base_amount * 0.21tax=quantity * 4.17` appear.

The solution consists in separating the operations using semi-colons and
a ternary operator to execute the if statement. The goal was to keep the
operations in a single line to avoid added escape caracters.

task-3319164

closes odoo/odoo#130792

X-original-commit: 2beea5f14a3886c5da9e81ccb8797141e7d7a186
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Antoine Boonen (aboo) <aboo@odoo.com>
This commit is contained in:
Antoine Boonen
2023-08-04 09:43:37 +02:00
parent e8d9a21b5c
commit 0b18fa884b
@@ -360,7 +360,7 @@
"","","","","","","","","","","","","","","","","","base","refund","","l10n_in.tax_tag_base_cess"
"","","","","","","","","","","","","","","","","","tax","refund","p10055","l10n_in.tax_tag_cess"
"cess_5_plus_1591_sale","5%+1.591 CESS S","CESS 5%+1.591","CESS 5%+1.591","sale","group","0.0","","","cess_group","","","cess_sale_5,cess_sale_1591","","","","","","","",""
"cess_21_4170_higer_sale","21% or 4.170 CESS S","CESS 21% or 4.170","CESS 21% or 4.170","sale","code","0.0","","","cess_group","","","","result=base_amount * 0.21tax=quantity * 4.17if tax > result:result=tax","","","","base","invoice","","l10n_in.tax_tag_base_cess"
"cess_21_4170_higer_sale","21% or 4.170 CESS S","CESS 21% or 4.170","CESS 21% or 4.170","sale","code","0.0","","","cess_group","","","","result=base_amount * 0.21; tax=quantity * 4.17; result = tax if (tax > result) else result;","","","","base","invoice","","l10n_in.tax_tag_base_cess"
"","","","","","","","","","","","","","","","","","tax","invoice","p11235","l10n_in.tax_tag_cess"
"","","","","","","","","","","","","","","","","","base","refund","","l10n_in.tax_tag_base_cess"
"","","","","","","","","","","","","","","","","","tax","refund","p10055","l10n_in.tax_tag_cess"
@@ -467,7 +467,7 @@
"","","","","","","","","","","","","","","","","","base","refund","","l10n_in.tax_tag_base_cess"
"","","","","","","","","","","","","","","","","","tax","refund","p11235","l10n_in.tax_tag_cess"
"cess_5_plus_1591_purchase","5%+1.591 CESS P","CESS 5%+1.591","CESS 5%+1.591","purchase","group","0.0","","","cess_group","","","cess_purchase_5,cess_purchase_1591","","","","","","","",""
"cess_21_4170_higer_purchase","21% or 4.170 CESS P","CESS 21% or 4.170","CESS 21% or 4.170","purchase","code","0.0","","","cess_group","","","","result=base_amount * 0.21tax=quantity * 4.17if tax > result:result=tax","","","","base","invoice","","l10n_in.tax_tag_base_cess"
"cess_21_4170_higer_purchase","21% or 4.170 CESS P","CESS 21% or 4.170","CESS 21% or 4.170","purchase","code","0.0","","","cess_group","","","","result=base_amount * 0.21; tax=quantity * 4.17; result = tax if (tax > result) else result;","","","","base","invoice","","l10n_in.tax_tag_base_cess"
"","","","","","","","","","","","","","","","","","tax","invoice","p10055","l10n_in.tax_tag_cess"
"","","","","","","","","","","","","","","","","","base","refund","","l10n_in.tax_tag_base_cess"
"","","","","","","","","","","","","","","","","","tax","refund","p11235","l10n_in.tax_tag_cess"
@@ -574,7 +574,7 @@
"","","","","","","","","","","","","","","","","","tax","refund","p10057",""
"","","","","","","","","","","","","","","","","-100","tax","refund","p10055","l10n_in.tax_tag_cess_rc"
"cess_5_plus_1591_purchase_rc","5%+1.591 CESS RC","CESS 5%+1.591","CESS 5%+1.591","purchase","group","0.0","","","cess_group","","","cess_purchase_5_rc,cess_purchase_1591_rc","","","True","","","","",""
"cess_21_4170_higer_purchase_rc","21% or 4.170 CESS RC","CESS 21% or 4.170","CESS 21% or 4.170","purchase","code","0.0","","","cess_group","","","","result=base_amount * 0.21tax=quantity * 4.17if tax > result:result=tax","","True","","base","invoice","","l10n_in.tax_tag_base_cess_rc"
"cess_21_4170_higer_purchase_rc","21% or 4.170 CESS RC","CESS 21% or 4.170","CESS 21% or 4.170","purchase","code","0.0","","","cess_group","","","","result=base_amount * 0.21; tax=quantity * 4.17; result = tax if (tax > result) else result;","","True","","base","invoice","","l10n_in.tax_tag_base_cess_rc"
"","","","","","","","","","","","","","","","","","tax","invoice","p10057",""
"","","","","","","","","","","","","","","","","-100","tax","invoice","p11235","l10n_in.tax_tag_cess_rc"
"","","","","","","","","","","","","","","","","","base","refund","","l10n_in.tax_tag_base_cess_rc"
1 id name description invoice_label type_tax_use amount_type amount tax_scope active tax_group_id is_base_affected include_base_amount children_tax_ids python_compute sequence l10n_in_reverse_charge repartition_line_ids/factor_percent repartition_line_ids/repartition_type repartition_line_ids/document_type repartition_line_ids/account_id repartition_line_ids/tag_ids
360 base refund l10n_in.tax_tag_base_cess
361 tax refund p10055 l10n_in.tax_tag_cess
362 cess_5_plus_1591_sale 5%+1.591 CESS S CESS 5%+1.591 CESS 5%+1.591 sale group 0.0 cess_group cess_sale_5,cess_sale_1591
363 cess_21_4170_higer_sale 21% or 4.170 CESS S CESS 21% or 4.170 CESS 21% or 4.170 sale code 0.0 cess_group result=base_amount * 0.21tax=quantity * 4.17if tax > result:result=tax result=base_amount * 0.21; tax=quantity * 4.17; result = tax if (tax > result) else result; base invoice l10n_in.tax_tag_base_cess
364 tax invoice p11235 l10n_in.tax_tag_cess
365 base refund l10n_in.tax_tag_base_cess
366 tax refund p10055 l10n_in.tax_tag_cess
467 base refund l10n_in.tax_tag_base_cess
468 tax refund p11235 l10n_in.tax_tag_cess
469 cess_5_plus_1591_purchase 5%+1.591 CESS P CESS 5%+1.591 CESS 5%+1.591 purchase group 0.0 cess_group cess_purchase_5,cess_purchase_1591
470 cess_21_4170_higer_purchase 21% or 4.170 CESS P CESS 21% or 4.170 CESS 21% or 4.170 purchase code 0.0 cess_group result=base_amount * 0.21tax=quantity * 4.17if tax > result:result=tax result=base_amount * 0.21; tax=quantity * 4.17; result = tax if (tax > result) else result; base invoice l10n_in.tax_tag_base_cess
471 tax invoice p10055 l10n_in.tax_tag_cess
472 base refund l10n_in.tax_tag_base_cess
473 tax refund p11235 l10n_in.tax_tag_cess
574 tax refund p10057
575 -100 tax refund p10055 l10n_in.tax_tag_cess_rc
576 cess_5_plus_1591_purchase_rc 5%+1.591 CESS RC CESS 5%+1.591 CESS 5%+1.591 purchase group 0.0 cess_group cess_purchase_5_rc,cess_purchase_1591_rc True
577 cess_21_4170_higer_purchase_rc 21% or 4.170 CESS RC CESS 21% or 4.170 CESS 21% or 4.170 purchase code 0.0 cess_group result=base_amount * 0.21tax=quantity * 4.17if tax > result:result=tax result=base_amount * 0.21; tax=quantity * 4.17; result = tax if (tax > result) else result; True base invoice l10n_in.tax_tag_base_cess_rc
578 tax invoice p10057
579 -100 tax invoice p11235 l10n_in.tax_tag_cess_rc
580 base refund l10n_in.tax_tag_base_cess_rc