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/stock/models/ |
Upload File : |
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models, _ class Company(models.Model): _inherit = "res.company" propagation_minimum_delta = fields.Integer('Minimum Delta for Propagation of a Date Change on moves linked together', default=1) internal_transit_location_id = fields.Many2one( 'stock.location', 'Internal Transit Location', on_delete="restrict", help="Technical field used for resupply routes between warehouses that belong to this company") @api.one def create_transit_location(self): '''Create a transit location with company_id being the given company_id. This is needed in case of resuply routes between warehouses belonging to the same company, because we don't want to create accounting entries at that time. ''' # TDE FIXME: called in data - should be done in init ?? parent_location = self.env.ref('stock.stock_location_locations', raise_if_not_found=False) location = self.env['stock.location'].create({ 'name': _('%s: Transit Location') % self.name, 'usage': 'transit', 'location_id': parent_location and parent_location.id or False, }) location.sudo().write({'company_id': self.id}) self.write({'internal_transit_location_id': location.id}) @api.model def create(self, vals): company = super(Company, self).create(vals) # mutli-company rules prevents creating warehouse and sub-locations self.env['stock.warehouse'].check_access_rights('create') self.env['stock.warehouse'].sudo().create({'name': company.name, 'code': company.name[:5], 'company_id': company.id}) company.create_transit_location() return company