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.

53 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, objects):
  8. report = objects
  9. return _('VAT Report - %s - %s') % (
  10. report.company_id.name, report.company_id.currency_id.name)
  11. def _get_report_columns(self, report):
  12. return {
  13. 0: {'header': _('Code'), 'field': 'code', 'width': 5},
  14. 1: {'header': _('Name'), 'field': 'name', 'width': 100},
  15. 2: {'header': _('Net'),
  16. 'field': 'net',
  17. 'type': 'amount',
  18. 'width': 14},
  19. 3: {'header': _('Tax'),
  20. 'field': 'tax',
  21. 'type': 'amount',
  22. 'width': 14},
  23. }
  24. def _get_report_filters(self, report):
  25. return [
  26. [_('Date from'), report.date_from],
  27. [_('Date to'), report.date_to],
  28. [_('Based on'), report.based_on],
  29. ]
  30. def _get_col_count_filter_name(self):
  31. return 0
  32. def _get_col_count_filter_value(self):
  33. return 2
  34. def _generate_report_content(self, workbook, report):
  35. # For each taxtag
  36. self.write_array_header()
  37. for taxtag in report.taxtags_ids:
  38. # Write taxtag line
  39. self.write_line(taxtag)
  40. # For each tax if detail taxes
  41. if report.tax_detail:
  42. for tax in taxtag.tax_ids:
  43. self.write_line(tax)