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.

84 lines
3.3 KiB

  1. # -*- encoding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # OpenERP, Open Source Management Solution
  5. #
  6. # Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
  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.osv import orm
  23. from openerp.addons.report_xls.utils import rowcol_to_cell, _render
  24. from openerp.tools.translate import _
  25. class account_journal(orm.Model):
  26. _inherit = 'account.journal'
  27. # allow inherited modules to extend the query
  28. def _report_xls_query_extra(self, cr, uid, context=None):
  29. select_extra = ""
  30. join_extra = ""
  31. where_extra = ""
  32. return (select_extra, join_extra, where_extra)
  33. # allow inherited modules to add document references
  34. def _report_xls_document_extra(self, cr, uid, context):
  35. return "''"
  36. # override list in inherited module to add/drop columns or change order
  37. def _report_xls_fields(self, cr, uid, context=None):
  38. res = [
  39. 'move_name', # account.move,name
  40. 'move_date', # account.move,date
  41. 'acc_code', # account.account,code
  42. ]
  43. if context.get('print_by') == 'fiscalyear':
  44. res += [
  45. 'period', # account.period,code or name
  46. ]
  47. res += [
  48. 'partner_name', # res.partner,name
  49. 'aml_name', # account.move.line,name
  50. 'tax_code', # account.tax.code,code
  51. 'tax_amount', # account.move.line,tax_amount
  52. 'debit', # account.move.line,debit
  53. 'credit', # account.move.line,credit
  54. 'balance', # debit-credit
  55. 'docname', # origin document if any
  56. #'date_maturity', # account.move.line,date_maturity
  57. #'reconcile', # account.move.line,reconcile_id.name
  58. #'reconcile_partial', # account.move.line,reconcile_partial_id.name
  59. #'partner_ref', # res.partner,ref
  60. #'move_ref', # account.move,ref
  61. #'move_id', # account.move,id
  62. ]
  63. return res
  64. # Change/Add Template entries
  65. def _report_xls_template(self, cr, uid, context=None):
  66. """
  67. Template updates, e.g.
  68. my_change = {
  69. 'move_name':{
  70. 'header': [1, 20, 'text', _render("_('My Move Title')")],
  71. 'lines': [1, 0, 'text', _render("l['move_name'] != '/' and l['move_name'] or ('*'+str(l['move_id']))")],
  72. 'totals': [1, 0, 'text', None]},
  73. }
  74. return my_change
  75. """
  76. return {}