Server IP : 127.0.0.2 / Your IP : 18.118.27.44 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/event_sale/tests/ |
Upload File : |
# -*- coding: utf-8 -*- from odoo.tests import common class EventSaleTest(common.TransactionCase): def setUp(self): super(EventSaleTest, self).setUp() self.EventRegistration = self.env['event.registration'] # First I create an event product product = self.env['product.product'].create({ 'name': 'test_formation', 'type': 'service', 'event_ok': True, }) # I create an event from the same type than my product event = self.env['event.event'].create({ 'name': 'test_event', 'event_type_id': 1, 'date_end': '2012-01-01 19:05:15', 'date_begin': '2012-01-01 18:05:15' }) # I create a sale order self.sale_order = self.env['sale.order'].create({ 'partner_id': self.env.ref('base.res_partner_2').id, 'note': 'Invoice after delivery', 'payment_term_id': self.env.ref('account.account_payment_term').id }) # In the sale order I add some sale order lines. i choose event product self.env['sale.order.line'].create({ 'product_id': product.id, 'price_unit': 190.50, 'product_uom': self.env.ref('product.product_uom_unit').id, 'product_uom_qty': 8.0, 'order_id': self.sale_order.id, 'name': 'sale order line', 'event_id': event.id }) # In the event registration I add some attendee detail lines. i choose event product self.register_person = self.env['registration.editor'].create({ 'sale_order_id': self.sale_order.id, 'event_registration_ids': [(0, 0, { 'event_id': event.id, 'name': 'Administrator', 'email': 'abc@example.com' })], }) def test_00_create_event_product(self): # I click apply to create attendees self.register_person.action_make_registration() # I check if a registration is created registrations = self.EventRegistration.search([('origin', '=', self.sale_order.name)]) self.assertTrue(registrations, "The registration is not created.")