def _check_external_dependencies(terp): depends = terp.get('external_dependencies') if not depends: return for pydep in depends.get('python', []): Module._check_python_external_dependency(pydep) for binary in depends.get('bin', []): try: tools.find_in_path(binary) except IOError: raise Exception('Unable to find %r in path' % (binary,))
def _check_external_dependencies(terp): depends = terp.get('external_dependencies') if not depends: return for pydep in depends.get('python', []): try: importlib.import_module(pydep) except ImportError: raise ImportError('No module named %s' % (pydep, )) for binary in depends.get('bin', []): try: tools.find_in_path(binary) except IOError: raise Exception('Unable to find %r in path' % (binary, ))
# -*- coding: utf-8 -*- # Copyright 2017 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). import logging from flectra import api, fields, models, tools from flectra.tools import DEFAULT_SERVER_DATETIME_FORMAT from datetime import datetime _logger = logging.getLogger(__name__) try: from numpy import mean NUMPY_PATH = tools.find_in_path('numpy') except (ImportError, IOError) as err: _logger.debug(err) class StockLocation(models.Model): _inherit = 'stock.location' @api.multi def _compute_loc_accuracy(self): for self in self: history = self.env['stock.inventory'].search([ ('location_id', '=', self.id), ('state', '=', 'done') ]) history = history.sorted(key=lambda r: r.write_date, reverse=True) if history:
# Copyright 2017-18 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). import logging from flectra import api, fields, models, tools from flectra.tools import DEFAULT_SERVER_DATETIME_FORMAT from datetime import datetime _logger = logging.getLogger(__name__) try: from statistics import mean STATS_PATH = tools.find_in_path('statistics') except (ImportError, IOError) as err: _logger.debug(err) class StockLocation(models.Model): _inherit = 'stock.location' @api.multi def _compute_loc_accuracy(self): for rec in self: history = self.env['stock.inventory'].search([ ('location_id', '=', rec.id), ('state', '=', 'done') ]) history = history.sorted(key=lambda r: r.write_date, reverse=True) if history: wh = rec.get_warehouse() if wh.counts_for_accuracy_qty and \