Meera Trambadia (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-account-file-coverage-mtr into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account-file-coverage-mtr/+merge/78552
Account:- checked methods of account.move, account.tax.code and recurring lines
in yml as per the coverage of account.py
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account-file-coverage-mtr/+merge/78552
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-account-file-coverage-mtr.
=== modified file 'account/test/account_supplier_invoice.yml'
--- account/test/account_supplier_invoice.yml 2011-01-14 00:11:01 +0000
+++ account/test/account_supplier_invoice.yml 2011-10-07 09:27:47 +0000
@@ -1,6 +1,26 @@
-
In order to test account invoice I create a new supplier invoice
-
+ I create a Tax Codes
+-
+ !record {model: account.tax.code, id: tax_case}:
+ name: Tax_case
+ company_id: base.main_company
+ sign: 1
+-
+ I create a Tax
+-
+ !record {model: account.tax, id: tax10}:
+ name: Tax 10.0
+ amount: 10.0
+ type: fixed
+ sequence: 1
+ company_id: base.main_company
+ type_tax_use: all
+ tax_code_id: tax_case
+-
+ I create a supplier invoice
+-
!record {model: account.invoice, id: account_invoice_supplier0}:
account_id: account.a_pay
address_contact_id: base.res_partner_address_3000
@@ -15,6 +35,8 @@
product_id: product.product_product_pc1
quantity: 10.0
uos_id: product.product_uom_unit
+ invoice_line_tax_id:
+ - tax10
journal_id: account.expenses_journal
partner_id: base.res_partner_desertic_hispafuentes
reference_type: none
@@ -32,4 +54,38 @@
I check that the invoice state is now "Open"
-
!assert {model: account.invoice, id: account_invoice_supplier0}:
- - state == 'open'
\ No newline at end of file
+ - state == 'open'
+-
+ I verify that account move is created
+-
+ !python {model: account.invoice}: |
+ move_obj = self.pool.get('account.move')
+ inv = self.browse(cr, uid, ref('account_invoice_supplier0'))
+ move = move_obj.browse(cr, uid, [inv.move_id.id])[0]
+ get_period = move_obj._get_period(cr, uid, {'lang': u'en_US', 'active_model': 'ir.ui.menu',
+ 'active_ids': [ref('menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('menu_action_move_journal_line_form')})
+ amt = move_obj._search_amount(cr, uid, move_obj, 'amount', [('amount', '=', 3100.0)], {'lang': u'en_US', 'active_model': 'ir.ui.menu',
+ 'active_ids': [ref('menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('menu_action_move_journal_line_form')})
+ ids = amt[0][2]
+ amt_compute = move_obj._amount_compute(cr, uid, list(ids), 'amount', None, {'lang': u'en_US', 'active_model': 'ir.ui.menu',
+ 'active_ids': [ref('menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('menu_action_move_journal_line_form')}, where ='')
+ move_amount = amt_compute.values()
+ assert(inv.move_id and move.period_id.id == get_period and move_amount[0] == 3100.0), ('Journal Entries has not been created')
+-
+ I cancel the account move which is in posted state and verifies that it gives warning message
+-
+ !python {model: account.move}: |
+ inv_obj = self.pool.get('account.invoice')
+ inv = inv_obj.browse(cr, uid, ref('account_invoice_supplier0'))
+ try:
+ mov_cancel = self.button_cancel(cr, uid, [inv.move_id.id], {'lang': u'en_US', 'tz': False,
+ 'active_model': 'ir.ui.menu', 'journal_type': 'purchase', 'active_ids': [ref('menu_action_invoice_tree2')],
+ 'type': 'in_invoice', 'active_id': ref('menu_action_invoice_tree2')})
+ except Exception, e:
+ assert e, _('Warning message has not been raised')
+-
+ I verify that 'Period Sum' and 'Year sum' of account tax codes gets bind with the values
+-
+ !python {model: account.tax.code}: |
+ tax_code = self.browse(cr, uid, ref('tax_case'))
+ assert(tax_code.sum_period == 100.0 and tax_code.sum == 100.0), _("'Period Sum' and 'Year sum' has not been binded with the correct values")
=== modified file 'account/test/account_use_model.yml'
--- account/test/account_use_model.yml 2011-01-14 00:11:01 +0000
+++ account/test/account_use_model.yml 2011-10-07 09:27:47 +0000
@@ -6,20 +6,24 @@
lines_id:
- account_id: account.a_recv
credit: 0.0
+ debit: 100.0
+ name: model_line_db
+ sequence: 0.0
+ quantity: 0.0
+ partner_id: base.res_partner_3
+ - account_id: account.a_pay
+ credit: 100.0
debit: 0.0
- name: test1
+ name: model_line_cr
sequence: 0.0
quantity: 0.0
partner_id: base.res_partner_3
name: My Test Model
-
-
I create an account use model record
-
-
!record {model: account.use.model, id: account_use_model_0}:
{}
-
-
I create entries.
-
@@ -29,4 +33,45 @@
False, "active_id": ref("account_model_mymodelonyears0"), })
move_obj = self.pool.get('account.move')
ids = move_obj.search(cr, uid, [('ref', '=', 'My Test Model')])
- assert len(ids), "Error:moves not created for model 'My Test Model'"
\ No newline at end of file
+ assert len(ids), "Error:moves not created for model 'My Test Model'"
+-
+ Then I click on the 'Post' button of Journal Entries
+-
+ !python {model: account.move}: |
+ ids = self.search(cr, uid, [('ref', '=', 'My Test Model')])
+ self.button_validate(cr, uid, ids, {'lang': u'en_US', 'active_model': 'ir.ui.menu',
+ 'active_ids': [ref('menu_action_move_journal_line_form')], 'tz': False, 'active_id': ref('menu_action_move_journal_line_form')})
+ moves = self.browse(cr, uid, ids)[0]
+ assert(moves.state == 'posted'), _('Journal Entries are not in posted state')
+-
+ Then I create Recurring Lines
+-
+ !record {model: account.subscription, id: test_recurring_lines }:
+ name: Test Recurring Lines
+ model_id: account_model_mymodelonyears0
+ date_start: !eval time.strftime('%Y-%m-%d')
+ period_nbr: 1
+ period_total: 12
+ period_type: 'day'
+-
+ Then I click on the 'Compute' button of Recurring lines
+-
+ !python {model: account.subscription}: |
+ subscription_line_obj = self.pool.get('account.subscription.line')
+ self.compute(cr, uid, [ref('test_recurring_lines')], {'lang': u'en_US', 'active_model': 'ir.ui.menu',
+ 'active_ids': [ref('menu_action_subscription_form')], 'tz': False, 'active_id': ref('menu_action_subscription_form')})
+ subscription_lines = subscription_line_obj.search(cr, uid, [('subscription_id', '=', ref('test_recurring_lines'))])
+ assert subscription_lines, _('Subscription lines has not been created')
+-
+ I provide date in 'Generate Entries' wizard
+-
+ !record {model: account.subscription.generate, id: account_subscription_generate}:
+ date: !eval time.strftime('%Y-%m-%d')
+-
+ Then I generate entries through wizard
+-
+ !python {model: account.subscription.generate}: |
+ res = self.action_generate(cr, uid, [ref('account_subscription_generate')], {'lang': u'en_US', 'active_model': 'ir.ui.menu',
+ 'active_ids': [ref('menu_generate_subscription')], 'tz': False, 'active_id': ref('menu_generate_subscription')})
+ assert res, _('Move for subscription lines has not been created')
+
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp