Launchpad automatic translations update.
[odoo/odoo.git] / addons / hr_expense / test / test_hr_expense.yml
1 -
2   In order to test hr_expenses for OpenERP, I create expenses for employee and manage employee's expenses.
3 -
4   I create an unit of measure category "Working Time".
5 -
6   !record {model: product.uom.categ, id: product_uom_categ_workingtime0}:
7     name: Working Time.
8
9 -
10   I create a new employee.
11 -
12   !record {model: hr.employee, id: hr.employee1}:
13     address_home_id: base.res_partner_address_1
14     address_id: base.main_address
15 -
16   I create product unit of measure "Hour".
17 -
18   !record {model: product.uom, id: product_uom_hour0}:
19     category_id: 'product_uom_categ_workingtime0'
20     factor: 8.0
21     name: Hour
22     rounding: 0.01
23 -
24    I Create a product "travel".
25 -
26   !record {model: product.product, id: product_product_travel0}:
27     categ_id: product.product_category_services
28     cost_method: standard
29     hr_expense_ok: 1
30     list_price: 800.0
31     mes_type: fixed
32     name: Travel
33     procure_method: make_to_stock
34     standard_price: 700.0
35     supply_method: buy
36     type: product
37     uom_id: 'product_uom_hour0'
38     uom_po_id: 'product_uom_hour0'
39     volume: 0.0
40     warranty: 0.0
41     weight: 0.0
42     weight_net: 0.0
43
44 -
45   I create an expense.
46 -
47   !record {model: hr.expense.expense, id: hr_expense_expense_september0}:
48     company_id: base.main_company
49     currency_id: base.EUR
50     date: !eval "'%s-05-05' %(datetime.now().year)"
51     employee_id: hr.employee1
52     name: September Expenses
53     line_ids:
54       - date_value: !eval "'%s-05-27' %(datetime.now().year)"
55         name: Travel
56         product_id: 'product_product_travel0'
57         sequence: 0.0
58         uom_id: product.product_uom_unit
59         unit_amount: 700.0
60     user_id: base.user_root
61 -
62   I check that expense is in "Draft" state.
63 -
64   !assert {model: hr.expense.expense, id: hr_expense_expense_september0}:
65     - state == 'draft'
66 -
67   I confirm this expenses by click on "Confirm" button.
68 -
69   !workflow {model: hr.expense.expense, action: confirm, ref: hr_expense_expense_september0}
70
71 -
72   I check that state is "Waiting Confirmation".
73 -
74   !assert {model: hr.expense.expense, id: hr_expense_expense_september0}:
75     - state == 'confirm'
76 -
77   I accept this expense by click on "Accept" button.
78 -
79   !workflow {model: hr.expense.expense, action: validate, ref: hr_expense_expense_september0}
80
81 -
82   I invoiced this expense by click on "Invoice" button.
83 -
84   !workflow {model: hr.expense.expense, action: invoice, ref: hr_expense_expense_september0}
85
86 -
87   I check that state is "Invoiced"
88 -
89   !assert {model: hr.expense.expense, id: hr_expense_expense_september0}:
90     - state == 'invoiced'
91 -
92   I check that Invoice is created for the expense.
93 -
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"