diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index c501de64896..02aaf9b8c2e 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -86,11 +86,11 @@ class hr_expense_expense(osv.osv):
('cancelled', 'Refused'),
('confirm', 'Waiting Approval'),
('accepted', 'Approved'),
- ('receipted', 'Receipted'),
+ ('receipted', 'Waiting Reimbursement'),
('paid', 'Reimbursed')
],
'Status', readonly=True, help='When the expense request is created the status is \'Draft\'.\n It is confirmed by the user and request is sent to admin, the status is \'Waiting Confirmation\'.\
- \nIf the admin accepts it, the status is \'Accepted\'.\n If a receipt is made for the expense request, the status is \'Receipted\'.\n If the expense is paid to user, the status is \'Reimbursed\'.'),
+ \nIf the admin accepts it, the status is \'Accepted\'.\n If a receipt is made for the expense request, the status is \'Waiting Reimbursement\'.\n If the expense is paid to user, the status is \'Reimbursed\'.'),
}
_defaults = {
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.employee', context=c),
@@ -134,27 +134,6 @@ class hr_expense_expense(osv.osv):
self.write(cr, uid, ids, {'state':'paid'})
return True
- def receipt(self, cr, uid, ids, context=None):
- mod_obj = self.pool.get('ir.model.data')
- wkf_service = netsvc.LocalService("workflow")
-
- voucher_ids = []
- for id in ids:
- wkf_service.trg_validate(uid, 'hr.expense.expense', id, 'receipt', cr)
- voucher_ids.append(self.browse(cr, uid, id, context=context).voucher_id.id)
- res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_purchase_receipt_form')
- return {
- 'name': _('Expense Receipt'),
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'account.voucher',
- 'view_id': [res and res[1] or False],
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- 'nodestroy': True,
- 'res_id': voucher_ids and voucher_ids[0] or False,
- }
-
def action_receipt_create(self, cr, uid, ids, context=None):
res = False
property_obj = self.pool.get('ir.property')
@@ -162,6 +141,7 @@ class hr_expense_expense(osv.osv):
analytic_journal_obj = self.pool.get('account.analytic.journal')
account_journal = self.pool.get('account.journal')
voucher_obj = self.pool.get('account.voucher')
+ wkf_service = netsvc.LocalService("workflow")
for exp in self.browse(cr, uid, ids, context=context):
company_id = exp.company_id.id
@@ -212,6 +192,7 @@ class hr_expense_expense(osv.osv):
if analytic_journal_ids:
account_journal.write(cr, uid, [journal.id], {'analytic_journal_id': analytic_journal_ids[0]}, context=context)
voucher_id = voucher_obj.create(cr, uid, voucher, context=context)
+ wkf_service.trg_validate(uid, 'account.voucher', voucher_id, 'proforma_voucher', cr)
self.write(cr, uid, [exp.id], {'voucher_id': voucher_id, 'state': 'receipted'}, context=context)
res = voucher_id
return res
diff --git a/addons/hr_expense/hr_expense_view.xml b/addons/hr_expense/hr_expense_view.xml
index b33d6e05474..b84674b6369 100644
--- a/addons/hr_expense/hr_expense_view.xml
+++ b/addons/hr_expense/hr_expense_view.xml
@@ -68,7 +68,7 @@
-
+
diff --git a/addons/hr_expense/hr_expense_workflow.xml b/addons/hr_expense/hr_expense_workflow.xml
index 58eed45b1d2..445927c0288 100644
--- a/addons/hr_expense/hr_expense_workflow.xml
+++ b/addons/hr_expense/hr_expense_workflow.xml
@@ -50,8 +50,7 @@
receipt
- subflow
-
+ functionaction_receipt_create()
@@ -99,7 +98,7 @@
- subflow.done
+ paid
diff --git a/addons/hr_expense/test/expense_process.yml b/addons/hr_expense/test/expense_process.yml
index 65359de95ff..7734a003ebb 100644
--- a/addons/hr_expense/test/expense_process.yml
+++ b/addons/hr_expense/test/expense_process.yml
@@ -20,13 +20,13 @@
I make Receipt for the expense.
-
!python {model: hr.expense.expense}: |
- self.receipt(cr, uid, [ref('sep_expenses')])
+ self.action_receipt_create(cr, uid, [ref('sep_expenses')])
-
I check receipt details.
-
!python {model: hr.expense.expense}: |
sep_expenses = self.browse(cr, uid, ref("sep_expenses"), context=context)
- assert sep_expenses.state == 'receipted', "Expense should be in 'Receipted' state."
+ assert sep_expenses.state == 'receipted', "Expense should be in 'Waiting Reimbursement' state."
assert sep_expenses.voucher_id.name == sep_expenses.name,"Receipt name is not correspond with expense name."
assert sep_expenses.voucher_id.type == 'purchase', "Receipt type is not purchase receipt."
assert sep_expenses.voucher_id.amount == sep_expenses.amount,"Receipt total amount is not correspond with expense total."