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.

39 lines
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. # © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from odoo import api, fields, models
  5. class BankReconciliationReportWizard(models.TransientModel):
  6. _name = "bank.reconciliation.report.wizard"
  7. _description = "Bank Reconciliation Report Wizard"
  8. @api.model
  9. def _default_journal_ids(self):
  10. journals = self.env['account.journal'].search([
  11. ('type', '=', 'bank'),
  12. ('bank_account_id', '!=', False),
  13. ('company_id', '=', self.env.user.company_id.id),
  14. ])
  15. return journals
  16. date = fields.Date(
  17. required=True,
  18. default=fields.Date.context_today)
  19. journal_ids = fields.Many2many(
  20. 'account.journal', string='Bank Journals',
  21. domain=[('type', '=', 'bank')], required=True,
  22. default=_default_journal_ids)
  23. def open_xlsx(self):
  24. action = {
  25. 'type': 'ir.actions.report.xml',
  26. 'report_name': 'bank.reconciliation.xlsx',
  27. 'datas': {
  28. 'model': self._name,
  29. 'ids': self.ids,
  30. },
  31. 'context': self._context,
  32. }
  33. return action