2 Test with that Finance manager who can only create supplier invoice.
5 uid: 'res_users_account_manager'
7 In order to test account invoice I create a new supplier invoice
11 !record {model: account.tax.code, id: tax_case}:
13 company_id: base.main_company
18 !record {model: account.tax, id: tax10}:
23 company_id: base.main_company
27 I create a supplier invoice
29 !record {model: account.invoice, id: account_invoice_supplier0, view: invoice_supplier_form}:
30 account_id: account.a_pay
32 company_id: base.main_company
35 - account_id: account.a_expense
36 name: '[PCSC234] PC Assemble SC234'
38 product_id: product.product_product_3
40 uos_id: product.product_uom_unit
43 journal_id: account.expenses_journal
44 partner_id: base.res_partner_12
48 I check that Initially supplier invoice state is "Draft"
50 !assert {model: account.invoice, id: account_invoice_supplier0}:
53 I change the state of invoice to open by clicking Validate button
55 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier0}
57 I check that the invoice state is now "Open"
59 !assert {model: account.invoice, id: account_invoice_supplier0}:
62 I verify that account move is created
64 !python {model: account.invoice}: |
65 move_obj = self.pool.get('account.move')
66 inv = self.browse(cr, uid, ref('account_invoice_supplier0'))
68 get_period = move_obj._get_period(cr, uid, {'lang': u'en_US', 'active_model': 'ir.ui.menu',
69 'active_ids': [ref('menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('menu_action_move_journal_line_form')})
70 amt = move_obj._search_amount(cr, uid, move_obj, 'amount', [('amount', '=', 3100.0)], {'lang': u'en_US', 'active_model': 'ir.ui.menu',
71 'active_ids': [ref('menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('menu_action_move_journal_line_form')})
73 amt_compute = move_obj._amount_compute(cr, uid, list(ids), 'amount', None, {'lang': u'en_US', 'active_model': 'ir.ui.menu',
74 'active_ids': [ref('menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('menu_action_move_journal_line_form')}, where ='')
75 move_amount = amt_compute.values()
76 assert(inv.move_id and move.period_id.id == get_period and move_amount[0] == 3100.0), ('Journal Entries has not been created')
78 I cancel the account move which is in posted state and verifies that it gives warning message
80 !python {model: account.move}: |
81 inv_obj = self.pool.get('account.invoice')
82 inv = inv_obj.browse(cr, uid, ref('account_invoice_supplier0'))
84 mov_cancel = self.button_cancel(cr, uid, [inv.move_id.id], {'lang': u'en_US', 'tz': False,
85 'active_model': 'ir.ui.menu', 'journal_type': 'purchase', 'active_ids': [ref('menu_action_invoice_tree2')],
86 'type': 'in_invoice', 'active_id': ref('menu_action_invoice_tree2')})
88 assert e, 'Warning message has not been raised'
90 I verify that 'Period Sum' and 'Year sum' of the tax code are the expected values
92 !python {model: account.tax.code}: |
93 tax_code = self.browse(cr, uid, ref('tax_case'))
94 assert(tax_code.sum_period == 100.0 and tax_code.sum == 100.0), "Incorrect 'Period Sum' / 'Year sum' expected twice 100.0, got period=%r and year=%r)" % (tax_code.sum_period,tax_code.sum)