Files
odoo_source/addons/hr_expense/models/account_move_line.py
T
Yannick Tivisse 717f9217bb [IMP] hr_expense: bring back the sheets + other new features
NB:
- The option no_delete is not working, a fix will come from chm
- The many2many widget on a sheet creation is not working correctly as
  the called command is a (1, id, values) without a (4, id, _) before.
  A fix will also come from chm, but a disgusting hack has been
  provided for this particular case (to remove after chm fix)
2016-06-17 12:14:57 +02:00

18 lines
795 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, models
from openerp.tools import float_compare
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
@api.multi
def reconcile(self, writeoff_acc_id=False, writeoff_journal_id=False):
res = super(AccountMoveLine, self).reconcile(writeoff_acc_id=writeoff_acc_id, writeoff_journal_id=writeoff_journal_id)
account_move_ids = [l.move_id.id for l in self if float_compare(l.move_id.matched_percentage, 1, precision_digits=5) == 0]
if account_move_ids:
expense_sheets = self.env['hr.expense.sheet'].search([('account_move_id', 'in', account_move_ids)])
expense_sheets.set_to_paid()
return res