code improvement code improvement payment_method to payment_method_id writeoff_account to writeoff_account_id property_account_receivable to property_account_receivable_id property_account_payable to property_account_payable_id property_account_expense_categ to property_account_expense_categ_id property_account_income_categ to property_account_income_categ_id property_account_expense to property_account_expense_id property_account_income to property_account_income_id property_account_expense_categ fix sale_tax to sale_tax_id and default_sale_tax to default_sale_tax_id purchase_tax to purchase_tax_id and default_purchase_tax to default_purchase_tax_id ref_companies to ref_companies_ids property_account_position to property_account_position_id property_payment_term to property_payment_term_id property_supplier_payment_term to property_supplier_payment_term_id bank_accounts_id to bank_accounts_ids payment_method fix after rebase user_type after rebase payment_method fix after rebase after rebase invoice to invoice_id fix payment_method_id after rebase code improvement [IMP]user_type to user_type_id [IMP]property_stock_account_input_categ, property_stock_account_output_categ to _id [IMP]improve after rebase [IMP]fix type [IMP]Account: code improvement
42 lines
1.7 KiB
Python
42 lines
1.7 KiB
Python
from openerp.addons.account.tests.account_test_classes import AccountingTestCase
|
|
|
|
class TestAccountValidateAccount(AccountingTestCase):
|
|
|
|
def test_account_validate_account(self):
|
|
account_move_line = self.env['account.move.line']
|
|
account_cash = self.env['account.account'].search([('user_type_id.type', '=', 'liquidity')], limit=1)
|
|
journal = self.env['account.journal'].search([('type', '=', 'bank')], limit=1)
|
|
|
|
company_id = self.env['res.users'].browse(self.env.uid).company_id.id
|
|
|
|
# create move
|
|
move = self.env['account.move'].create({'name': '/',
|
|
'ref':'2011010',
|
|
'journal_id': journal.id,
|
|
'state':'draft',
|
|
'company_id': company_id,
|
|
})
|
|
# create move line
|
|
account_move_line.create({'account_id': account_cash.id,
|
|
'name': 'Basic Computer',
|
|
'move_id': move.id,
|
|
})
|
|
|
|
# create another move line
|
|
account_move_line.create({'account_id': account_cash.id,
|
|
'name': 'Basic Computer',
|
|
'move_id': move.id,
|
|
})
|
|
|
|
# check that Initially account move state is "Draft"
|
|
self.assertTrue((move.state == 'draft'), "Initially account move state is Draft")
|
|
|
|
# validate this account move by using the 'Post Journal Entries' wizard
|
|
validate_account_move = self.env['validate.account.move'].with_context(active_ids=move.id).create({})
|
|
|
|
#click on validate Button
|
|
validate_account_move.with_context({'active_ids': [move.id]}).validate_move()
|
|
|
|
#check that the move state is now "Posted"
|
|
self.assertTrue((move.state == 'posted'), "Initially account move state is Posted")
|