Server IP : 127.0.0.2 / Your IP : 3.21.106.4 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 fields, models class RemovalStrategy(models.Model): _name = 'product.removal' _description = 'Removal Strategy' name = fields.Char('Name', required=True) method = fields.Char("Method", required=True, help="FIFO, LIFO...") class PutAwayStrategy(models.Model): _name = 'product.putaway' _description = 'Put Away Strategy' name = fields.Char('Name', required=True) method = fields.Selection('_get_putaway_options', "Method", default='fixed', required=True) fixed_location_ids = fields.One2many( 'stock.fixed.putaway.strat', 'putaway_id', 'Fixed Locations Per Product Category', copy=True, help="When the method is fixed, this location will be used to store the products") def _get_putaway_options(self): return [('fixed', 'Fixed Location')] def _putaway_apply_fixed(self, product): for strat in self.fixed_location_ids: categ = product.categ_id while categ: if strat.category_id.id == categ.id: return strat.fixed_location_id.id categ = categ.parent_id return self.env['stock.location'] def putaway_apply(self, product): if hasattr(self, '_putaway_apply_%s' % (self.method)): return getattr(self, '_putaway_apply_%s' % (self.method))(product) return self.env['stock.location'] class FixedPutAwayStrategy(models.Model): _name = 'stock.fixed.putaway.strat' _order = 'sequence' putaway_id = fields.Many2one('product.putaway', 'Put Away Method', required=True) category_id = fields.Many2one('product.category', 'Product Category', required=True) fixed_location_id = fields.Many2one('stock.location', 'Location', required=True) sequence = fields.Integer('Priority', help="Give to the more specialized category, a higher priority to have them in top of the list.")