Server IP : 127.0.0.2 / Your IP : 3.145.216.39 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /opt/odoo/addons/account_budget/tests/ |
Upload File : |
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from .common import TestAccountBudgetCommon from odoo.fields import Date import datetime # --------------------------------------------------------- # Tests # --------------------------------------------------------- class TestAccountBudget(TestAccountBudgetCommon): def test_account_budget(self): # Creating a crossovered.budget record budget = self.env['crossovered.budget'].create({ 'date_from': Date.from_string('%s-01-01' % (datetime.datetime.now().year + 1)), 'date_to': Date.from_string('%s-12-31' % (datetime.datetime.now().year + 1)), 'name': 'Budget %s' % (datetime.datetime.now().year + 1), 'state': 'draft' }) # I created two different budget lines # Modifying a crossovered.budget record self.env['crossovered.budget.lines'].create({ 'crossovered_budget_id': budget.id, 'analytic_account_id': self.ref('analytic.analytic_partners_camp_to_camp'), 'date_from': Date.from_string('%s-01-01' % (datetime.datetime.now().year + 1)), 'date_to': Date.from_string('%s-12-31' % (datetime.datetime.now().year + 1)), 'general_budget_id': self.account_budget_post_purchase0.id, 'planned_amount': 10000.0, }) self.env['crossovered.budget.lines'].create({ 'crossovered_budget_id': budget.id, 'analytic_account_id': self.ref('analytic.analytic_our_super_product'), 'date_from': Date.from_string('%s-09-01' % (datetime.datetime.now().year + 1)), 'date_to': Date.from_string('%s-09-30' % (datetime.datetime.now().year + 1)), 'general_budget_id': self.account_budget_post_sales0.id, 'planned_amount': 400000.0, }) # I check that Initially Budget is in "draft" state self.assertEqual(budget.state, 'draft') # I pressed the confirm button to confirm the Budget # Performing an action confirm on module crossovered.budget budget.action_budget_confirm() # I check that budget is in "Confirmed" state self.assertEqual(budget.state, 'confirm') # I pressed the validate button to validate the Budget # Performing an action validate on module crossovered.budget budget.action_budget_validate() # I check that budget is in "Validated" state self.assertEqual(budget.state, 'validate') # I pressed the done button to set the Budget to "Done" state # Performing an action done on module crossovered.budget budget.action_budget_done() # I check that budget is in "done" state self.assertEqual(budget.state, 'done')