diff --git a/addons/hr_expense/__manifest__.py b/addons/hr_expense/__manifest__.py
index e6fc131ba8a..77bea25f140 100644
--- a/addons/hr_expense/__manifest__.py
+++ b/addons/hr_expense/__manifest__.py
@@ -32,8 +32,8 @@ This module also uses analytic accounting and is compatible with the invoice on
'security/ir.model.access.csv',
'data/hr_expense_data.xml',
'data/hr_expense_sequence.xml',
- 'wizard/hr_expense_refuse_reason.xml',
- 'wizard/hr_expense_register_payment.xml',
+ 'wizard/hr_expense_refuse_reason_views.xml',
+ 'wizard/hr_expense_sheet_register_payment.xml',
'views/hr_expense_views.xml',
'security/ir_rule.xml',
'report/report_expense_sheet.xml',
diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py
index a5a26185b50..d30810eeb1e 100644
--- a/addons/hr_expense/models/hr_expense.py
+++ b/addons/hr_expense/models/hr_expense.py
@@ -44,6 +44,7 @@ class HrExpense(models.Model):
help="Status of the expense.")
sheet_id = fields.Many2one('hr.expense.sheet', string="Expense Report", readonly=True, copy=False)
reference = fields.Char(string="Bill Reference")
+ is_refused = fields.Boolean(string="Explicitely Refused by manager or acccountant", readonly=True, copy=False)
@api.depends('sheet_id', 'sheet_id.account_move_id', 'sheet_id.state')
def _compute_state(self):
@@ -307,6 +308,13 @@ class HrExpense(models.Model):
res['context'] = {'default_res_model': 'hr.expense', 'default_res_id': self.id}
return res
+ @api.multi
+ def refuse_expense(self,reason):
+ self.write({'is_refused': True})
+ self.sheet_id.write({'state': 'cancel'})
+ self.sheet_id.message_post_with_view('hr_expense.hr_expense_template_refuse_reason',
+ values={'reason': reason, 'is_sheet':False, 'name':self.name})
+
@api.model
def get_empty_list_help(self, help_message):
if help_message:
@@ -392,7 +400,7 @@ class HrExpenseSheet(models.Model):
('done', 'Paid'),
('cancel', 'Refused')
], string='Status', index=True, readonly=True, track_visibility='onchange', copy=False, default='submit', required=True,
- help='Expense Report State')
+ help='Expense Report State')
employee_id = fields.Many2one('hr.employee', string="Employee", required=True, readonly=True, states={'submit': [('readonly', False)]}, default=lambda self: self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1))
address_id = fields.Many2one('res.partner', string="Employee Home Address")
payment_mode = fields.Selection([("own_account", "Employee (to reimburse)"), ("company_account", "Company")], related='expense_line_ids.payment_mode', default='own_account', readonly=True, string="Payment By")
@@ -512,11 +520,11 @@ class HrExpenseSheet(models.Model):
self.attachment_number = sum(self.expense_line_ids.mapped('attachment_number'))
@api.multi
- def refuse_expenses(self, reason):
+ def refuse_sheet(self, reason):
self.write({'state': 'cancel'})
for sheet in self:
- body = (_("Your Expense %s has been refused.
Your Expense
- The steps to process expenses are: -