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.

31 lines
1.3 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
  3. # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  4. # Julien Weste (julien.weste@akretion.com.br)
  5. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  6. from openerp import fields, models, api
  7. class AccountBankStatement(models.Model):
  8. _inherit = 'account.bank.statement'
  9. total_entry_encoding_sales = fields.Monetary(
  10. 'Sale Transactions Subtotal', compute='_compute_total_entries',
  11. store=True, multi='total_entries',
  12. help="Total of sale transaction lines.")
  13. total_entry_encoding_cash = fields.Monetary(
  14. 'Cash Moves', compute='_compute_total_entries', store=True,
  15. multi='total_entries', help="Total of cash inputs or outputs.")
  16. @api.multi
  17. @api.depends(
  18. 'line_ids', 'balance_start', 'line_ids.amount', 'balance_end_real')
  19. def _compute_total_entries(self):
  20. for abst in self:
  21. abst.total_entry_encoding_sales = sum(
  22. [line.amount for line in abst.line_ids
  23. if line.pos_statement_id])
  24. abst.total_entry_encoding_cash = sum(
  25. [line.amount for line in abst.line_ids
  26. if not line.pos_statement_id])