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.

92 lines
3.8 KiB

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