Server IP : 127.0.0.2 / Your IP : 3.141.164.124 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/point_of_sale/tests/ |
Upload File : |
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo.api import Environment import odoo.tests class TestUi(odoo.tests.HttpCase): def test_01_pos_basic_order(self): cr = self.registry.cursor() assert cr == self.registry.test_cr env = Environment(cr, self.uid, {}) journal_obj = env['account.journal'] account_obj = env['account.account'] main_company = env.ref('base.main_company') main_pos_config = env.ref('point_of_sale.pos_config_main') account_receivable = account_obj.create({'code': 'X1012', 'name': 'Account Receivable - Test', 'user_type_id': env.ref('account.data_account_type_receivable').id, 'reconcile': True}) field = self.env['ir.model.fields'].search([('name', '=', 'property_account_receivable_id'), ('model', '=', 'res.partner'), ('relation', '=', 'account.account')], limit=1) env['ir.property'].create({'name': 'property_account_receivable_id', 'company_id': main_company.id, 'fields_id': field.id, 'value': 'account.account,' + str(account_receivable.id)}) # set the company currency to USD, otherwise it will assume # euro's. this will cause issues as the sale journal is in # USD, because of this all products would have a different # price main_company.currency_id = env.ref('base.USD') test_sale_journal = journal_obj.create({'name': 'Sale Journal - Test', 'code': 'TSJ', 'type': 'sale', 'company_id': main_company.id}) env['product.pricelist'].search([]).write(dict(currency_id=main_company.currency_id.id)) main_pos_config.write({ 'journal_id': test_sale_journal.id, 'invoice_journal_id': test_sale_journal.id, 'journal_ids': [(0, 0, {'name': 'Cash Journal - Test', 'code': 'TSC', 'type': 'cash', 'company_id': main_company.id, 'journal_user': True})]}) # open a session, the /pos/web controller will redirect to it main_pos_config.open_session_cb() # needed because tests are run before the module is marked as # installed. In js web will only load qweb coming from modules # that are returned by the backend in module_boot. Without # this you end up with js, css but no qweb. env['ir.module.module'].search([('name', '=', 'point_of_sale')], limit=1).state = 'installed' cr.release() self.phantom_js("/pos/web", "odoo.__DEBUG__.services['web_tour.tour'].run('pos_basic_order')", "odoo.__DEBUG__.services['web_tour.tour'].tours.pos_basic_order.ready", login="admin") for order in env['pos.order'].search([]): self.assertEqual(order.state, 'paid', "Validated order has payment of " + str(order.amount_paid) + " and total of " + str(order.amount_total))