Files
odoo_source/addons/hr_expense/wizard/hr_expense_refuse_reason.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

23 lines
705 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class HrExpenseRefuseWizard(models.TransientModel):
_name = "hr.expense.refuse.wizard"
_description = "Hr Expense refuse Reason wizard"
description = fields.Char(string='Reason', required=True)
@api.multi
def expense_refuse_reason(self):
self.ensure_one()
context = dict(self._context or {})
active_ids = context.get('active_ids', [])
expense_sheet = self.env['hr.expense.sheet'].browse(active_ids)
expense_sheet.refuse_expenses(self.description)
return {'type': 'ir.actions.act_window_close'}