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.

62 lines
2.1 KiB

8 years ago
8 years ago
8 years ago
8 years ago
  1. # -*- coding: utf-8 -*-
  2. # Author: Thomas Rehn, Guewen Baconnier
  3. # Copyright 2016 initOS GmbH, camptocamp
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  5. from openerp import models, fields, api
  6. class AccountBalanceCommonWizard(models.TransientModel):
  7. """Will launch some balance report wizards and pass required args"""
  8. _inherit = "account.common.account.report"
  9. _name = "account.common.balance.report"
  10. _description = "Common Balance Report"
  11. @api.model
  12. def _get_account_ids(self):
  13. context = self.env.context or {}
  14. res = False
  15. if context.get('active_model', False) == 'account.account' \
  16. and context.get('active_ids', False):
  17. res = context['active_ids']
  18. return res
  19. account_ids = fields.Many2many(
  20. comodel_name='account.account',
  21. string='Filter on accounts',
  22. help="Only selected accounts will be printed. Leave empty to "
  23. "print all accounts.",
  24. default=_get_account_ids
  25. )
  26. date_range_id = fields.Many2one(
  27. comodel_name='date.range',
  28. string='Date Range',
  29. )
  30. comparison_date_range_id = fields.Many2one(
  31. comodel_name='date.range',
  32. string='Date Range',
  33. )
  34. comparison_date_start = fields.Datetime(
  35. string='Start Date'
  36. )
  37. comparison_date_end = fields.Datetime(
  38. string='End Date'
  39. )
  40. partner_ids = fields.Many2many(
  41. comodel_name='res.partner',
  42. string='Filter on partner',
  43. help="Only selected partners will be printed. "
  44. "Leave empty to print all partners."
  45. )
  46. debit_credit = fields.Boolean(
  47. string='Display Debit/Credit Columns',
  48. help="This option allows you to get more details about the way your "
  49. "balances are computed. Because it is space consuming, "
  50. "we do not allow to use it while doing a comparison."
  51. )
  52. def pre_print_report(self, cr, uid, ids, data, context=None):
  53. data = super(AccountBalanceCommonWizard, self).pre_print_report(
  54. cr, uid, ids, data, context)
  55. return data