diff options
| author | Christophe Simonis <chs@odoo.com> | 2015-07-22 19:11:44 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2015-07-22 19:11:44 +0200 |
| commit | 3ea8d14d2b06643a87fa5bf794d3e16180a6e1af (patch) | |
| tree | 204ab1451bcc5a7c4757fe133e46496d5abfc0e6 /addons/analytic | |
| parent | e182f196945385d6381c9f52c5e51062b80947df (diff) | |
[FIX] account,analytic: move test from account to analytic
Diffstat (limited to 'addons/analytic')
| -rw-r--r-- | addons/analytic/__openerp__.py | 3 | ||||
| -rw-r--r-- | addons/analytic/security/ir.model.access.csv | 5 | ||||
| -rw-r--r-- | addons/analytic/test/analytic_hierarchy.yml | 54 |
3 files changed, 61 insertions, 1 deletions
diff --git a/addons/analytic/__openerp__.py b/addons/analytic/__openerp__.py index df9834af534..d9acfcc8501 100644 --- a/addons/analytic/__openerp__.py +++ b/addons/analytic/__openerp__.py @@ -38,6 +38,9 @@ that have no counterpart in the general financial accounts. 'data/analytic_demo.xml', 'data/analytic_account_demo.xml', ], + 'test': [ + 'test/analytic_hierarchy.yml', + ], 'installable': True, 'auto_install': False, } diff --git a/addons/analytic/security/ir.model.access.csv b/addons/analytic/security/ir.model.access.csv index 58262d4440d..9ca53cdff14 100644 --- a/addons/analytic/security/ir.model.access.csv +++ b/addons/analytic/security/ir.model.access.csv @@ -1 +1,4 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
\ No newline at end of file +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_analytic_account,access_account_analytic_account,model_account_analytic_account,group_analytic_accounting,1,0,0,0 +access_account_analytic_line,access_account_analytic_line,model_account_analytic_line,group_analytic_accounting,1,0,0,0 +access_account_analytic_journal,access_account_analytic_journal,model_account_analytic_journal,group_analytic_accounting,1,0,0,0 diff --git a/addons/analytic/test/analytic_hierarchy.yml b/addons/analytic/test/analytic_hierarchy.yml new file mode 100644 index 00000000000..222e03aa062 --- /dev/null +++ b/addons/analytic/test/analytic_hierarchy.yml @@ -0,0 +1,54 @@ +- + We create a simple hierarchy like this + Toplevel view account + ├ Real analytic account 1 + └ Real analytic account 2 +- + !record {model: account.analytic.account, id: analytic_account_view1}: + name: 'Toplevel view account' + type: 'view' +- + !record {model: account.analytic.account, id: analytic_account1}: + name: 'Real analytic account 1' + type: 'normal' + parent_id: analytic_account_view1 +- + !record {model: account.analytic.account, id: analytic_account2}: + name: 'Real analytic account 2' + type: 'normal' + parent_id: analytic_account_view1 +- + We add analytic lines in real accounts and journal +- + !record {model: account.analytic.journal, id: analytic_journal1}: + name: 'Analytic journal' +- + !record {model: account.analytic.line, id: analytic_line1}: + name: 'Analytic line 1' + account_id: analytic_account1 + journal_id: analytic_journal1 +- + !record {model: account.analytic.line, id: analytic_line2}: + name: 'Analytic line 2' + account_id: analytic_account2 + journal_id: analytic_journal1 +- + Now we copy the toplevel account +- + !function {model: account.analytic.account, name: copy, id: analytic_account_view1}: + - eval: "ref('analytic_account_view1')" +- + !python {model: account.analytic.account}: | + # the toplevel account has been copied with the (copy) suffix + accounts = self.search(cr, uid, [('name', 'like', '%Toplevel view account%')]) + assert len(accounts) == 2, 'The toplevel account has not been copied' + accounts = self.search(cr, uid, [('name', '=', 'Toplevel view account')]) + assert len(accounts) == 1, 'The toplevel account copy has a bad name' + # the sub-accounts and sub-accounts have been copied without the (copy) suffix + accounts = self.search(cr, uid, [('name', '=', 'Real analytic account 1')]) + assert len(accounts) == 2, 'The sub-account has not been copied' + accounts = self.search(cr, uid, [('name', '=', 'Real analytic account 2')]) + assert len(accounts) == 2, 'The sub-account has not been copied' + # the analytic lines should not be duplicated + lines = self.pool.get('account.analytic.line').search(cr, uid, [('name', 'like', '%Analytic line %')]) + assert len(lines) == 2, "The analytic lines shouldn't have been copied" |
