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.

54 lines
2.1 KiB

9 years ago
  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # OpenERP, Open Source Management Solution
  5. # This module copyright (C) 2015 Therp BV (<http://therp.nl>).
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU Affero General Public License as
  9. # published by the Free Software Foundation, either version 3 of the
  10. # License, or (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU Affero General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Affero General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. ##############################################################################
  21. import copy
  22. from openerp import models
  23. from openerp.addons.account.report.account_financial_report import\
  24. report_account_common
  25. class report_account_common_horizontal(report_account_common):
  26. def __init__(self, cr, uid, name, context=None):
  27. super(report_account_common_horizontal, self).__init__(
  28. cr, uid, name, context=context)
  29. self.localcontext.update({
  30. 'get_left_lines': self.get_left_lines,
  31. 'get_right_lines': self.get_right_lines,
  32. })
  33. def get_lines(self, data, side=None):
  34. data = copy.deepcopy(data)
  35. if data['form']['used_context'] is None:
  36. data['form']['used_context'] = {}
  37. data['form']['used_context'].update(
  38. account_financial_report_horizontal_side=side)
  39. return super(report_account_common_horizontal, self).get_lines(
  40. data)
  41. def get_left_lines(self, data):
  42. return self.get_lines(data, side='left')
  43. def get_right_lines(self, data):
  44. return self.get_lines(data, side='right')
  45. class ReportFinancial(models.AbstractModel):
  46. _inherit = 'report.account.report_financial'
  47. _wrapped_report_class = report_account_common_horizontal