- Test validate account move with user who is accountant which have its rights.' - !context uid: 'res_users_account_user' - In order to test the account move lines in OpenERP, I create account move - I create a Account tax code - !record {model: account.tax.code, id: account_tax_code_0}: name : Tax Code Test sign : 1.00 - In order to test the 'Post Journal Entries' wizard in OpenERP, I created an account move - !record {model: account.move, id: account_move_0}: date: !eval time.strftime('%Y-%m-%d') period_id: account.period_6 journal_id: account.bank_journal line_id: - account_id: account.cash amount_currency: 0.0 credit: 2000.0 debit: 0.0 name: Basic Computer partner_id: base.res_partner_12 ref: '2011010' tax_amount: 0.0 name: / ref: '2011010' state: draft - I create another move line - !python {model: account.move.line}: | import time date = self._get_date(cr, uid, { 'journal_id': 1, 'period_id': 6,}) partner = self.onchange_partner_id(cr, uid, [], False, ref('base.res_partner_12'), ref('account.cash'), debit=0, credit=2000, date=date, journal=False) account = self.onchange_account_id(cr, uid, [], account_id=ref('account.a_recv'), partner_id= ref('base.res_partner_12')) vals = { 'journal_id': ref('account.bank_journal'), 'period_id': ref('account.period_6'), 'ref': '2011010', 'tax_code_id': ref('account_tax_code_0'), 'tax_amount': 0.0, 'account_id': ref('account.a_recv'), 'amount_currency': 0.0, 'credit': 0.0, 'date': time.strftime('%Y-%m-%d'), 'debit': 2000.0, 'name': 'Basic Computer', 'partner_id': ref('base.res_partner_12'), 'quantity': 0.0, 'move_id': ref('account_move_0'), 'date_maturity': partner['value']['date_maturity'], 'account_tax_id': account['value']['account_tax_id'] } line_id = self.create(cr, uid, vals) assert line_id, "Account move line has not been created" - I check the balance in Journal Items - !python {model: account.move.line}: | ids = self._balance_search(cr, uid, self, 'balance', [('balance', '=', 2000.0)], None, {'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'search_default_journal_id': 1, 'journal_type': 'sale', 'search_default_period_id': 6, 'view_mode': False, 'visible_id': 1, 'search_default_posted': 0}) bal = self._balance(cr, uid, ids[0][2], 'balance', None,{'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu', 'search_default_journal_id': 1, 'journal_type': 'sale', 'search_default_period_id': 6, 'view_mode': False, 'visible_id': 1, 'search_default_posted': 0}) assert bal, 'Balance has not been computed correctly' - I check that Initially account move state is "Draft" - !assert {model: account.move, id: account_move_0, string: initialstatedraft}: - state == 'draft' - I validate this account move by using the 'Post Journal Entries' wizard - !record {model: validate.account.move, id: validate_account_move_0}: journal_id: account.bank_journal period_id: account.period_6 - I click on validate Button - !python {model: validate.account.move}: | self.validate_move(cr, uid, [ref("validate_account_move_0")], {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_validate_account_moves")], "tz": False, "active_id": ref("account.menu_validate_account_moves"), }) - I check that the move state is now "Posted" - !assert {model: account.move, id: account_move_0, string: moveincorrect}: - state == 'posted' - I reconcile the entries partially through "Reconcile Entries" wizard - !record {model: account.move.line.reconcile, id: account_move_line_reconcile0}: trans_nbr: 1 credit: 0.0 debit: 2000.0 writeoff: 2000.0 - Then I click on the 'Partial Reconcile' button - !python {model: account.move.line.reconcile}: | move_line_obj = self.pool.get('account.move.line') ids = move_line_obj.search(cr, uid, [('move_id', '=', ref('account_move_0')),('credit', '=', 2000)]) partial_reconcile = self.trans_rec_reconcile_partial_reconcile(cr, uid, [ref('account_move_line_reconcile0')], {'lang': u'en_US', 'active_model': 'account.move.line', 'active_ids': ids, 'tz': False, 'active_id': ids[0]}) move_line = move_line_obj.browse(cr, uid, ids) assert move_line[0].reconcile_partial_id, "Partial reconcilation is not done"