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.

89 lines
3.6 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. class account_journal(orm.Model):
  24. _inherit = 'account.journal'
  25. # allow inherited modules to extend the query
  26. def _report_xls_query_extra(self, cr, uid, context=None):
  27. select_extra = ""
  28. join_extra = ""
  29. where_extra = ""
  30. return (select_extra, join_extra, where_extra)
  31. # allow inherited modules to add document references
  32. def _report_xls_document_extra(self, cr, uid, context):
  33. return "''"
  34. # override list in inherited module to add/drop columns or change order
  35. def _report_xls_fields(self, cr, uid, context=None):
  36. res = [
  37. 'move_name', # account.move,name
  38. 'move_date', # account.move,date
  39. 'acc_code', # account.account,code
  40. ]
  41. if context.get('print_by') == 'fiscalyear':
  42. res += [
  43. 'period', # account.period,code or name
  44. ]
  45. res += [
  46. 'partner_name', # res.partner,name
  47. 'aml_name', # account.move.line,name
  48. 'tax_code', # account.tax.code,code
  49. 'tax_amount', # account.move.line,tax_amount
  50. 'debit', # account.move.line,debit
  51. 'credit', # account.move.line,credit
  52. 'balance', # debit-credit
  53. 'docname', # origin document if any
  54. # 'date_maturity', # account.move.line,date_maturity
  55. # 'reconcile', # account.move.line,reconcile_id.name
  56. # 'reconcile_partial',
  57. # account.move.line,reconcile_partial_id.name
  58. # 'partner_ref', # res.partner,ref
  59. # 'move_ref', # account.move,ref
  60. # 'move_id', # account.move,id
  61. # 'acc_name', # account.account,name
  62. # 'journal', # account.journal,name
  63. # 'journal_code', # account.journal,code
  64. # 'analytic_account', # account.analytic.account,name
  65. # 'analytic_account_code', # account.analytic.account,code
  66. ]
  67. return res
  68. # Change/Add Template entries
  69. def _report_xls_template(self, cr, uid, context=None):
  70. """
  71. Template updates, e.g.
  72. my_change = {
  73. 'move_name':{
  74. 'header': [1, 20, 'text', _render("_('My Move Title')")],
  75. 'lines': [1, 0, 'text', _render("l['move_name'] != '/' and
  76. l['move_name'] or ('*'+str(l['move_id']))")],
  77. 'totals': [1, 0, 'text', None]},
  78. }
  79. return my_change
  80. """
  81. return {}