You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.6 KiB

  1. # Copyright 2018 Forest and Biomass Romania
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo import _, models
  4. class VATReportXslx(models.AbstractModel):
  5. _name = 'report.a_f_r.report_vat_report_xlsx'
  6. _inherit = 'report.account_financial_report.abstract_report_xlsx'
  7. def _get_report_name(self, report):
  8. report_name = _('VAT Report')
  9. return self._get_report_complete_name(report, report_name)
  10. def _get_report_columns(self, report):
  11. return {
  12. 0: {'header': _('Code'), 'field': 'code', 'width': 5},
  13. 1: {'header': _('Name'), 'field': 'name', 'width': 100},
  14. 2: {'header': _('Net'),
  15. 'field': 'net',
  16. 'type': 'amount',
  17. 'width': 14},
  18. 3: {'header': _('Tax'),
  19. 'field': 'tax',
  20. 'type': 'amount',
  21. 'width': 14},
  22. }
  23. def _get_report_filters(self, report):
  24. return [
  25. [_('Date from'), report.date_from],
  26. [_('Date to'), report.date_to],
  27. [_('Based on'), report.based_on],
  28. ]
  29. def _get_col_count_filter_name(self):
  30. return 0
  31. def _get_col_count_filter_value(self):
  32. return 2
  33. def _generate_report_content(self, workbook, report):
  34. # For each taxtag
  35. self.write_array_header()
  36. for taxtag in report.taxtags_ids:
  37. # Write taxtag line
  38. self.write_line(taxtag)
  39. # For each tax if detail taxes
  40. if report.tax_detail:
  41. for tax in taxtag.tax_ids:
  42. self.write_line(tax)