[FIX] account: display tax base on invoice report
The condition that determines whether to display the tax base was wrong It should be displayed when either condition is met: - There are multiple tax base amounts - The only tax base amount is not the same as the untaxed amount Note that this last case may happen with cash discounts closes odoo/odoo#102247 X-original-commit: a8ff4b876c8ab48177795e6ace1bb1361744c8a7 Signed-off-by: Camille Spiritus (casp) <casp@odoo.com> Signed-off-by: Stanislas Gueniffey (stgu) <stgu@odoo.com>
This commit is contained in:
@@ -1188,7 +1188,8 @@ class AccountTax(models.Model):
|
||||
|
||||
amount_total = amount_untaxed + amount_tax
|
||||
|
||||
display_tax_base = len(global_tax_details['tax_details']) == 1 and tax_group_vals['base_amount'] != amount_untaxed
|
||||
display_tax_base = (len(global_tax_details['tax_details']) == 1 and tax_group_vals_list[0]['base_amount'] != amount_untaxed) \
|
||||
or len(global_tax_details['tax_details']) > 1
|
||||
|
||||
return {
|
||||
'amount_untaxed': currency.round(amount_untaxed) if currency else amount_untaxed,
|
||||
|
||||
@@ -111,7 +111,7 @@ class TestTaxTotals(AccountTestInvoicingCommon):
|
||||
self.assertTaxTotals(document, {
|
||||
'amount_total': 3600,
|
||||
'amount_untaxed': 3000,
|
||||
'display_tax_base': False,
|
||||
'display_tax_base': True,
|
||||
'groups_by_subtotal': {
|
||||
'Untaxed Amount': [
|
||||
{
|
||||
@@ -226,7 +226,7 @@ class TestTaxTotals(AccountTestInvoicingCommon):
|
||||
self.assertTaxTotals(document, {
|
||||
'amount_total': 3620,
|
||||
'amount_untaxed': 3000,
|
||||
'display_tax_base': False,
|
||||
'display_tax_base': True,
|
||||
'groups_by_subtotal': {
|
||||
'Untaxed Amount': [
|
||||
{
|
||||
@@ -313,7 +313,7 @@ class TestTaxTotals(AccountTestInvoicingCommon):
|
||||
self.assertTaxTotals(document, {
|
||||
'amount_total': 2750,
|
||||
'amount_untaxed': 2000,
|
||||
'display_tax_base': False,
|
||||
'display_tax_base': True,
|
||||
'groups_by_subtotal': {
|
||||
'Untaxed Amount': [
|
||||
{
|
||||
@@ -400,7 +400,7 @@ class TestTaxTotals(AccountTestInvoicingCommon):
|
||||
self.assertTaxTotals(document, {
|
||||
'amount_total': 2846,
|
||||
'amount_untaxed': 2300,
|
||||
'display_tax_base': False,
|
||||
'display_tax_base': True,
|
||||
'groups_by_subtotal': {
|
||||
'Untaxed Amount': [
|
||||
{
|
||||
@@ -486,7 +486,7 @@ class TestTaxTotals(AccountTestInvoicingCommon):
|
||||
self.assertTaxTotals(document, {
|
||||
'amount_total': 1867,
|
||||
'amount_untaxed': 1500,
|
||||
'display_tax_base': False,
|
||||
'display_tax_base': True,
|
||||
'groups_by_subtotal': {
|
||||
'Untaxed Amount': [
|
||||
{
|
||||
@@ -584,7 +584,7 @@ class TestTaxTotals(AccountTestInvoicingCommon):
|
||||
self.assertTaxTotals(document, {
|
||||
'amount_total': 1230.41,
|
||||
'amount_untaxed': 1020.41,
|
||||
'display_tax_base': False,
|
||||
'display_tax_base': True,
|
||||
'groups_by_subtotal': {
|
||||
"Reapply amount": [{
|
||||
'tax_group_name': self.tax_group_sub3.name,
|
||||
|
||||
Reference in New Issue
Block a user