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.

61 lines
2.2 KiB

11 years ago
11 years ago
  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # OpenERP, Open Source Management Solution
  5. # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
  6. # Copyright (C) 2013 Agile Business Group sagl
  7. # (<http://www.agilebg.com>) (<lorenzo.battistini@agilebg.com>)
  8. #
  9. # This program is free software: you can redistribute it and/or modify
  10. # it under the terms of the GNU Affero General Public License as
  11. # published by the Free Software Foundation, either version 3 of the
  12. # License, or (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU Affero General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Affero General Public License
  20. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. #
  22. ##############################################################################
  23. from openerp.osv import orm, fields
  24. class account_pl_report(orm.TransientModel):
  25. """
  26. This wizard will provide the account profit and loss report by periods,
  27. between any two dates.
  28. """
  29. _inherit = "account_financial_report_horizontal.common.account.report"
  30. _name = "account.pl.report"
  31. _description = "Account Profit And Loss Report"
  32. _columns = {
  33. 'display_type': fields.boolean("Landscape Mode"),
  34. }
  35. _defaults = {
  36. 'display_type': True,
  37. 'target_move': 'all',
  38. }
  39. def _print_report(self, cr, uid, ids, data, context=None):
  40. if context is None:
  41. context = {}
  42. data = self.pre_print_report(cr, uid, ids, data, context=context)
  43. data['form'].update(self.read(cr, uid, ids, ['display_type'])[0])
  44. if data['form']['display_type']:
  45. return {
  46. 'type': 'ir.actions.report.xml',
  47. 'report_name': 'account.profit_horizontal',
  48. 'datas': data,
  49. }
  50. else:
  51. return {
  52. 'type': 'ir.actions.report.xml',
  53. 'report_name': 'account.profit_loss',
  54. 'datas': data,
  55. }