Server IP : 127.0.0.2 / Your IP : 18.116.47.33 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_margin/tests/ |
Upload File : |
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo.tests import common from datetime import datetime class TestSaleMargin(common.TransactionCase): def setUp(self): super(TestSaleMargin, self).setUp() self.SaleOrder = self.env['sale.order'] self.product_uom_id = self.ref('product.product_uom_unit') self.product_id = self.ref('product.product_product_24') self.partner_id = self.ref('base.res_partner_4') self.partner_invoice_address_id = self.ref('base.res_partner_address_7') self.pricelist_id = self.ref('product.list0') def test_sale_margin(self): """ Test the sale_margin module in Odoo. """ # Create a sale order for product Graphics Card. sale_order_so11 = self.SaleOrder.create({ 'date_order': datetime.today(), 'name': 'Test_SO011', 'order_line': [ (0, 0, { 'name': '[CARD] Graphics Card', 'purchase_price': 700.0, 'price_unit': 1000.0, 'product_uom': self.product_uom_id, 'product_uom_qty': 10.0, 'state': 'draft', 'product_id': self.product_id}), (0, 0, { 'name': 'Line without product_uom', 'price_unit': 1000.0, 'purchase_price': 700.0, 'product_uom_qty': 10.0, 'state': 'draft', 'product_id': self.product_id})], 'partner_id': self.partner_id, 'partner_invoice_id': self.partner_invoice_address_id, 'partner_shipping_id': self.partner_invoice_address_id, 'pricelist_id': self.pricelist_id}) # Confirm the sale order. sale_order_so11.action_confirm() # Verify that margin field gets bind with the value. self.assertEqual(sale_order_so11.margin, 6000.00, "Sale order margin should be 6000.00")