Skip to content

Commit

Permalink
[FIX] l10n_sale: revert change of _compute_tax_totals
Browse files Browse the repository at this point in the history
closes #128

Signed-off-by: Katherine Zaoral <kz@adhoc.com.ar>
  • Loading branch information
matiasperalta1 committed Aug 30, 2023
1 parent bec17b9 commit 26cb24c
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions l10n_ar_sale/models/sale_order.py
Expand Up @@ -60,26 +60,10 @@ def create(self, vals):

def _compute_tax_totals(self):
""" Mandamos en contexto el invoice_date para calculo de impuesto con partner aliquot
ver módulo l10n_ar_account_withholding. Además acá reemplazamos el método _compute_tax_totals del módulo sale original de odoo"""
ver módulo l10n_ar_account_withholding. """
for rec in self:
rec = rec.with_context(invoice_date=rec.date_order)
super(SaleOrder, rec)._compute_tax_totals()
report_or_portal_view = 'commit_assetsbundle' in self.env.context or \
not self.env.context.get('params', {}).get('view_type') == 'form'
if not report_or_portal_view:
return

for order in self.filtered(lambda x: not x.vat_discriminated):
tax_groups = order.order_line.mapped('tax_id.tax_group_id')
if not tax_groups:
continue
to_remove_ids = tax_groups.filtered(lambda x: x.l10n_ar_vat_afip_code).ids
tax_group_name = list(order.tax_totals['groups_by_subtotal'].keys())[0]
tax_group_vals = order.tax_totals['groups_by_subtotal'].get(tax_group_name)
updated_tax_group_vals = list(filter(lambda x: x.get('tax_group_id') not in to_remove_ids, tax_group_vals))
new_totals = order.tax_totals
new_totals['groups_by_subtotal'].update({tax_group_name: updated_tax_group_vals})
order.tax_totals = new_totals

def _get_name_sale_report(self, report_xml_id):
""" Method similar to the '_get_name_invoice_report' of l10n_latam_invoice_document
Expand Down

0 comments on commit 26cb24c

Please sign in to comment.