8000 Syncing from upstream odoo/odoo (staging.16.0) by bt-admin · Pull Request #33761 · brain-tec/odoo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Syncing from upstream odoo/odoo (staging.16.0) #33761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion addons/account/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class AccountTaxGroup(models.Model):
string="Preceding Subtotal",
help="If set, this value will be used on documents as the label of a subtotal excluding this tax group before displaying it. " \
"If not set, the tax group will be displayed after the 'Untaxed amount' subtotal.",
translate=True,
)

@api.model
Expand Down
19 changes: 9 additions & 10 deletions addons/l10n_ar/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,27 +377,26 @@ def _l10n_ar_get_invoice_totals_for_report(self):

# Prepare the subtotals to show in the report
currency_symbol = self.currency_id.symbol
detail_info = {}
detail_info = {
'vat_taxes': {'name': _("VAT Content %s", currency_symbol), 'tax_amount': 0.0, 'group': 'vat'},
'other_taxes': {'name': _("Other National Ind. Taxes %s", currency_symbol), 'tax_amount': 0.0,
'group': 'other'},
}

for subtotals in temp['groups_by_subtotal'].values():
for subtotal in subtotals:
tax_group_id = subtotal['tax_group_id']
tax_amount = subtotal['tax_group_amount']

if tax_group_id in nat_int_tax_groups.ids:
key = 'other_taxes'
name = _("Other National Ind. Taxes %s", currency_symbol)
elif tax_group_id in vat_tax_groups.ids:
key = 'vat_taxes'
name = _("VAT Content %s", currency_symbol)
else:
continue # If not belongs to the needed groups we ignore them

if key not in detail_info:
if tax_amount != 0.0:
detail_info[key] = {"name": name, "tax_amount": tax_amount}
else:
detail_info[key]["tax_amount"] += tax_amount
detail_info[key]["tax_amount"] += subtotal['tax_group_amount']

if detail_info['other_taxes']["tax_amount"] == 0.0:
detail_info.pop('other_taxes')

# Format the amounts to show in the report
for _item, values in detail_info.items():
Expand Down
32 changes: 25 additions & 7 deletions addons/l10n_ar/tests/test_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ def test_15_corner_cases(self):
if len_l10n_ar_price_unit_digits == len_line_price_unit_digits == decimal_price_digits_setting:
self.assertEqual(l10n_ar_price_unit_decimal_part, line_price_unit_decimal_part)

def _get_simple_detail_ar_tax(self, invoice):
""" Get the simple detail_ar_tax list of tuples with the vat group name and the amount
[("vat_taxes", float), ("other_taxes", float)] """
return [
(item.get('group'), item.get('tax_amount'))
for item in invoice._l10n_ar_get_invoice_totals_for_report().get('detail_ar_tax')
]

def test_16_invoice_b_tax_breakdown_1(self):
""" Display Both VAT and Other Taxes """
invoice1 = self._create_invoice_from_dict({
Expand All @@ -132,10 +140,7 @@ def test_16_invoice_b_tax_breakdown_1(self):
'tax_ids': [(6, 0, [self.tax_0.id, self.tax_other.id])]},
],
})
res1 = invoice1._l10n_ar_get_invoice_totals_for_report()
self.assertEqual(res1.get('detail_ar_tax'), [
{'formatted_amount_tax': '868.51', 'name': 'VAT Content $', 'tax_amount': 868.51},
{'formatted_amount_tax': '142.20', 'name': 'Other National Ind. Taxes $', 'tax_amount': 142.20}])
self.assertEqual(self._get_simple_detail_ar_tax(invoice1), [("vat", 868.51), ("other", 142.20)])

def test_17_invoice_b_tax_breakdown_2(self):
""" Display only Other Taxes (VAT taxes are 0) """
Expand All @@ -150,6 +155,19 @@ def test_17_invoice_b_tax_breakdown_2(self):
'tax_ids': [(6, 0, [self.tax_no_gravado.id, self.tax_internal.id])]},
],
})
res2 = invoice2._l10n_ar_get_invoice_totals_for_report()
self.assertEqual(res2.get('detail_ar_tax'), [
{'formatted_amount_tax': '300.00', 'name': 'Other National Ind. Taxes $', 'tax_amount': 300.00}])
self.assertEqual(self._get_simple_detail_ar_tax(invoice2), [("vat", 0.0), ("other", 300.0)])

def test_18_invoice_b_tax_breakdown_3(self):
""" Display only Other Taxes (VAT taxes are 0 and non other taxes) """
invoice3 = self._create_invoice_from_dict({
'ref': 'test_invoice_22: Final Consumer Invoice B with 0 only',
"move_type": 'out_invoice',
"partner_id": self.partner_cf,
"company_id": self.company_ri,
"invoice_date": "2021-03-20",
"invoice_line_ids": [
{'product_id': self.product_iva_105_perc, 'price_unit': 10000.0, 'quantity': 1,
'tax_ids': [(6, 0, [self.tax_no_gravado.id])]},
],
})
self.assertEqual(self._get_simple_detail_ar_tax(invoice3), [("vat", 0.0)])
2 changes: 1 addition & 1 deletion addons/l10n_id/migrations/1.2/end-migrate_update_taxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def migrate(cr, version):
"name": xmlid,
"module": "l10n_id",
"model": "account.tax.group",
"res_id": env['account.tax.group'].create({'name': name}).id,
"res_id": env['account.tax.group'].create({'name': name, 'country_id': env.ref('base.id').id}).id,
'noupdate': True
})

Expand Down
22 changes: 11 additions & 11 deletions addons/l10n_it/data/account.tax.group.csv
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
id,name,country_id/id,preceding_subtotal
tax_group_iva_2,IVA 2%,base.it,Taxable
tax_group_iva_4,IVA 4%,base.it,Taxable
tax_group_iva_5,IVA 5%,base.it,Taxable
tax_group_iva_10,IVA 10%,base.it,Taxable
tax_group_iva_12,IVA 12%,base.it,Taxable
tax_group_iva_21,IVA 21%,base.it,Taxable
tax_group_iva_20,IVA 20%,base.it,Taxable
tax_group_iva_22,IVA 22%,base.it,Taxable
tax_group_imp_esc_art_15,Imponibile Escluso Art.15,base.it,Taxable
tax_group_fuori,Fuori Campo IVA,base.it,Taxable
tax_group_split_payment,Scissione dei Pagamenti,base.it,Split Payments Excluded
tax_group_iva_2,IVA 2%,base.it,Imponibile
tax_group_iva_4,IVA 4%,base.it,Imponibile
tax_group_iva_5,IVA 5%,base.it,Imponibile
tax_group_iva_10,IVA 10%,base.it,Imponibile
tax_group_iva_12,IVA 12%,base.it,Imponibile
tax_group_iva_21,IVA 21%,base.it,Imponibile
tax_group_iva_20,IVA 20%,base.it,Imponibile
tax_group_iva_22,IVA 22%,base.it,Imponibile
tax_group_imp_esc_art_15,Imponibile Escluso Art.15,base.it,Imponibile
tax_group_fuori,Fuori Campo IVA,base.it,Imponibile
tax_group_split_payment,Scissione dei Pagamenti,base.it,Scissione dei Pagamenti Esclusa
Loading
0