Server IP : 127.0.0.2 / Your IP : 3.15.145.122 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/sale_order_dates/tests/ |
Upload File : |
# -*- coding: utf-8 -*- from datetime import timedelta from odoo.tests import common from odoo import fields class TestSaleOrderDates(common.TransactionCase): def test_sale_order_requested_date(self): # In order to test the Requested Date feature in Sale Orders in Odoo, # I copy a demo Sale Order with Requested Date on 2010-07-12 new_order = self.env.ref('sale.sale_order_6').copy({'requested_date': '2010-07-12'}) # I confirm the Sale Order. new_order.action_confirm() # I verify that the Procurements and Stock Moves have been generated with the correct date security_delay = timedelta(days=new_order.company_id.security_lead) requested_date = fields.Datetime.from_string(new_order.requested_date) right_date = fields.Datetime.to_string(requested_date - security_delay) for line in new_order.order_line: self.assertNotEqual(len(line.procurement_ids), 0, "No Procurement was created") procurement = line.procurement_ids[0] self.assertEqual(procurement.date_planned, right_date, "The planned date for the Procurement Order is wrong") self.assertNotEqual(len(procurement.move_ids), 0, "No Move was created") self.assertEqual(procurement.move_ids[0].date_expected, right_date, "The expected date for the Stock Move is wrong")