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.6 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # Author: Alexis de Lattre
  5. # Copyright 2015 Akretion (www.akretion.com)
  6. # Copyright 2014 Camptocamp SA
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU Affero General Public License as
  10. # published by the Free Software Foundation, either version 3 of the
  11. # License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU Affero General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU Affero General Public License
  19. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. #
  21. ##############################################################################
  22. from openerp import models, fields
  23. class AgedOpenInvoice(models.TransientModel):
  24. """Will launch age partner balance report.
  25. This report is based on Open Invoice Report
  26. and share a lot of knowledge with him
  27. """
  28. # pylint: disable=consider-merging-classes-inherited
  29. _inherit = "open.invoices.webkit"
  30. _name = "aged.open.invoices.webkit"
  31. _description = "Aged open invoices"
  32. filter = fields.Selection(default='filter_date')
  33. # pylint: disable=old-api7-method-defined
  34. def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False,
  35. period_id=False, date_to=False, until_date=False,
  36. context=None):
  37. res = super(AgedOpenInvoice, self).onchange_fiscalyear(
  38. cr, uid, ids, fiscalyear=fiscalyear, period_id=period_id,
  39. date_to=date_to, until_date=until_date, context=context
  40. )
  41. filters = self.onchange_filter(cr, uid, ids, filter='filter_period',
  42. fiscalyear_id=fiscalyear,
  43. context=context)
  44. res['value'].update({
  45. 'period_from': filters['value']['period_from'],
  46. 'period_to': filters['value']['period_to'],
  47. })
  48. return res
  49. # pylint: disable=old-api7-method-defined
  50. def _print_report(self, cr, uid, ids, data, context=None):
  51. # we update form with display account value
  52. data = self.pre_print_report(cr, uid, ids, data, context=context)
  53. return {'type': 'ir.actions.report.xml',
  54. 'report_name': 'account.account_aged_open_invoices_webkit',
  55. 'datas': data}