2 In order to test hr_expenses for OpenERP, I create expenses for employee and manage employee's expenses.
4 I create an unit of measure category "Working Time".
6 !record {model: product.uom.categ, id: product_uom_categ_workingtime0}:
10 I create a new employee.
12 !record {model: hr.employee, id: hr.employee1}:
13 address_home_id: base.res_partner_address_1
14 address_id: base.main_address
16 I create product unit of measure "Hour".
18 !record {model: product.uom, id: product_uom_hour0}:
19 category_id: 'product_uom_categ_workingtime0'
24 I Create a product "travel".
26 !record {model: product.product, id: product_product_travel0}:
27 categ_id: product.product_category_services
33 procure_method: make_to_stock
37 uom_id: 'product_uom_hour0'
38 uom_po_id: 'product_uom_hour0'
47 !record {model: hr.expense.expense, id: hr_expense_expense_september0}:
48 company_id: base.main_company
50 date: !eval "'%s-05-05' %(datetime.now().year)"
51 employee_id: hr.employee1
52 name: September Expenses
54 - date_value: !eval "'%s-05-27' %(datetime.now().year)"
56 product_id: 'product_product_travel0'
58 uom_id: product.product_uom_unit
60 user_id: base.user_root
62 I check that expense is in "Draft" state.
64 !assert {model: hr.expense.expense, id: hr_expense_expense_september0}:
67 I confirm this expenses by click on "Confirm" button.
69 !workflow {model: hr.expense.expense, action: confirm, ref: hr_expense_expense_september0}
72 I check that state is "Waiting Confirmation".
74 !assert {model: hr.expense.expense, id: hr_expense_expense_september0}:
77 I accept this expense by click on "Accept" button.
79 !workflow {model: hr.expense.expense, action: validate, ref: hr_expense_expense_september0}
82 I invoiced this expense by click on "Invoice" button.
84 !workflow {model: hr.expense.expense, action: invoice, ref: hr_expense_expense_september0}
87 I check that state is "Invoiced"
89 !assert {model: hr.expense.expense, id: hr_expense_expense_september0}:
92 I check that Invoice is created for the expense.
94 !python {model: hr.expense.expense}: |
95 exp = self.browse(cr, uid, [ref('hr_expense_expense_september0')])[0]
96 assert exp.invoice_id, "Invoice should be created"