2 In order to test account invoice I create a new supplier invoice
6 !record {model: account.tax.code, id: tax_case}:
8 company_id: base.main_company
13 !record {model: account.tax, id: tax10}:
18 company_id: base.main_company
22 I create a supplier invoice
24 !record {model: account.invoice, id: account_invoice_supplier0, view: invoice_supplier_form}:
25 account_id: account.a_pay
27 company_id: base.main_company
30 - account_id: account.a_expense
31 name: '[PCSC234] PC Assemble SC234'
33 product_id: product.product_product_3
35 uos_id: product.product_uom_unit
38 journal_id: account.expenses_journal
39 partner_id: base.res_partner_12
43 I check that Initially supplier invoice state is "Draft"
45 !assert {model: account.invoice, id: account_invoice_supplier0}:
48 I change the state of invoice to open by clicking Validate button
50 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier0}
52 I check that the invoice state is now "Open"
54 !assert {model: account.invoice, id: account_invoice_supplier0}:
57 I verify that account move is created
59 !python {model: account.invoice}: |
60 move_obj = self.pool.get('account.move')
61 inv = self.browse(cr, uid, ref('account_invoice_supplier0'))
63 get_period = move_obj._get_period(cr, uid, {'lang': u'en_US', 'active_model': 'ir.ui.menu',
64 'active_ids': [ref('menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('menu_action_move_journal_line_form')})
65 amt = move_obj._search_amount(cr, uid, move_obj, 'amount', [('amount', '=', 3100.0)], {'lang': u'en_US', 'active_model': 'ir.ui.menu',
66 'active_ids': [ref('menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('menu_action_move_journal_line_form')})
68 amt_compute = move_obj._amount_compute(cr, uid, list(ids), 'amount', None, {'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')}, where ='')
70 move_amount = amt_compute.values()
71 assert(inv.move_id and move.period_id.id == get_period and move_amount[0] == 3100.0), ('Journal Entries has not been created')
73 I cancel the account move which is in posted state and verifies that it gives warning message
75 !python {model: account.move}: |
76 inv_obj = self.pool.get('account.invoice')
77 inv = inv_obj.browse(cr, uid, ref('account_invoice_supplier0'))
79 mov_cancel = self.button_cancel(cr, uid, [inv.move_id.id], {'lang': u'en_US', 'tz': False,
80 'active_model': 'ir.ui.menu', 'journal_type': 'purchase', 'active_ids': [ref('menu_action_invoice_tree2')],
81 'type': 'in_invoice', 'active_id': ref('menu_action_invoice_tree2')})
83 assert e, 'Warning message has not been raised'
85 I verify that 'Period Sum' and 'Year sum' of the tax code are the expected values
87 !python {model: account.tax.code}: |
88 tax_code = self.browse(cr, uid, ref('tax_case'))
89 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)