Пример #1
0
def library_openssl_xsltproc_xmlstarlet(self, cr, uid, ids, context=None):
    if context is None:
        context = {}
    msj = ''
    app_openssl_fullpath = os.path.join(openssl_path, app_openssl)
    if not os.path.isfile(app_openssl_fullpath):
        app_openssl_fullpath = tools.find_in_path(app_openssl)
        if not os.path.isfile(app_openssl_fullpath):
            app_openssl_fullpath = False
            _logger.warning(
                'Install openssl "sudo apt-get install openssl" to use l10n_mx_facturae_lib module.'
            )
            msj += 'Install openssl "sudo apt-get install openssl" to use l10n_mx_facturae_lib module.'

    app_xsltproc_fullpath = os.path.join(xsltproc_path, app_xsltproc) or False
    if not os.path.isfile(app_xsltproc_fullpath):
        app_xsltproc_fullpath = tools.find_in_path(app_xsltproc) or False
        try:
            if not os.path.isfile(app_xsltproc_fullpath):
                app_xsltproc_fullpath = False
                _logger.warning(
                    "Install xsltproc 'sudo apt-get install xsltproc' to use l10n_mx_facturae_lib module."
                )
                msj = "Install xsltproc 'sudo apt-get install xsltproc' to use l10n_mx_facturae_lib module."
        except Exception, e:
            _logger.warning(
                "Install xsltproc 'sudo apt-get install xsltproc' to use l10n_mx_facturae_lib module."
            )
            msj += "Install xsltproc 'sudo apt-get install xsltproc' to use l10n_mx_facturae_lib module."
Пример #2
0
    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, ))
Пример #3
0
    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,))
Пример #4
0
    def _check_external_dependencies(terp):
        depends = terp.get('external_dependencies')
        if not depends:
            return
        for pydep in depends.get('python', []):
            parts = pydep.split('.')
            parts.reverse()
            path = None
            while parts:
                part = parts.pop()
                try:
                    _, path, _ = imp.find_module(part, path and [path] or None)
                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,))
Пример #5
0
    def _check_external_dependencies(terp):
        depends = terp.get('external_dependencies')
        if not depends:
            return
        for pydep in depends.get('python', []):
            parts = pydep.split('.')
            parts.reverse()
            path = None
            while parts:
                part = parts.pop()
                try:
                    _, path, _ = imp.find_module(part, path and [path] or None)
                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, ))
Пример #6
0
    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', []):
            if tools.find_in_path(binary) is None:
                raise Exception('Unable to find %r in path' % (binary,))
Пример #7
0
def library_openssl_xsltproc_xmlstarlet(self, cr, uid, ids, context=None):
    if context is None:
        context = {}
    msj = ''
    app_openssl_fullpath = os.path.join(openssl_path, app_openssl)
    if not os.path.isfile(app_openssl_fullpath):
        app_openssl_fullpath = tools.find_in_path(app_openssl)
        if not os.path.isfile(app_openssl_fullpath):
            app_openssl_fullpath = False
            _logger.warning('Install openssl "sudo apt-get install openssl" to use l10n_mx_facturae_lib module.')
            msj += 'Install openssl "sudo apt-get install openssl" to use l10n_mx_facturae_lib module.'
    
    app_xsltproc_fullpath = os.path.join(xsltproc_path, app_xsltproc) or False
    if not os.path.isfile(app_xsltproc_fullpath):
        app_xsltproc_fullpath = tools.find_in_path(app_xsltproc) or False
        try:
            if not os.path.isfile(app_xsltproc_fullpath):
                app_xsltproc_fullpath = False
                _logger.warning("Install xsltproc 'sudo apt-get install xsltproc' to use l10n_mx_facturae_lib module.")
                msj =  "Install xsltproc 'sudo apt-get install xsltproc' to use l10n_mx_facturae_lib module."
        except Exception, e:
            _logger.warning("Install xsltproc 'sudo apt-get install xsltproc' to use l10n_mx_facturae_lib module.")
            msj +=  "Install xsltproc 'sudo apt-get install xsltproc' to use l10n_mx_facturae_lib module."
Пример #8
0
    if os.name == "nt":
        cmd = cmd.replace(
            '"', '')  # provisionalmente, porque no funcionaba en win32
    return os.popen2(cmd, 'b')


if os.name == "nt":
    app_xsltproc = 'xsltproc.exe'
    app_openssl = 'openssl.exe'
else:
    app_xsltproc = 'xsltproc'
    app_openssl = 'openssl'

app_openssl_fullpath = os.path.join(openssl_path, app_openssl)
if not os.path.isfile(app_openssl_fullpath):
    app_openssl_fullpath = tools.find_in_path(app_openssl)

app_xsltproc_fullpath = os.path.join(xsltproc_path, app_xsltproc)
if not os.path.isfile(app_xsltproc_fullpath):
    app_xsltproc_fullpath = tools.find_in_path(app_xsltproc)


# TODO: Validar que esta instalado openssl & xsltproc
class facturae_certificate_library(osv.Model):
    _name = 'facturae.certificate.library'
    _auto = False

    # Agregar find subpath

    def b64str_to_tempfile(self, b64_str="", file_suffix="", file_prefix=""):
        """
Пример #9
0
            '"', '')  # provisionalmente, porque no funcionaba en win32
    return os.popen2(cmd, 'b')


if os.name == "nt":
    app_xsltproc = 'xsltproc.exe'
    app_openssl = 'openssl.exe'
    app_xmlstarlet = 'xmlstarlet.exe'
else:
    app_xsltproc = 'xsltproc'
    app_openssl = 'openssl'
    app_xmlstarlet = 'xmlstarlet'

app_openssl_fullpath = os.path.join(openssl_path, app_openssl)
if not os.path.isfile(app_openssl_fullpath):
    app_openssl_fullpath = tools.find_in_path(app_openssl)
    if not os.path.isfile(app_openssl_fullpath):
        app_openssl_fullpath = False
        _logger.warning(
            'Install openssl "sudo apt-get install openssl" to use l10n_mx_facturae_lib module.'
        )

app_xsltproc_fullpath = os.path.join(xsltproc_path, app_xsltproc) or False
try:
    if not os.path.isfile(app_xsltproc_fullpath):
        app_xsltproc_fullpath = tools.find_in_path(app_xsltproc) or False
        if not os.path.isfile(app_xsltproc_fullpath):
            app_xsltproc_fullpath = False
            _logger.warning(
                'Install xsltproc "sudo apt-get install xsltproc" to use l10n_mx_facturae_lib module.'
            )
Пример #10
0
        cmd = cmd.replace(
            '"', '')  # provisionalmente, porque no funcionaba en win32
    return os.popen2(cmd, 'b')

if os.name == "nt":
    app_xsltproc = 'xsltproc.exe'
    app_openssl = 'openssl.exe'
    app_xmlstarlet = 'xmlstarlet.exe'
else:
    app_xsltproc = 'xsltproc'
    app_openssl = 'openssl'
    app_xmlstarlet = 'xmlstarlet'

app_openssl_fullpath = os.path.join(openssl_path, app_openssl)
if not os.path.isfile(app_openssl_fullpath):
    app_openssl_fullpath = tools.find_in_path(app_openssl)
    if not os.path.isfile(app_openssl_fullpath):
        app_openssl_fullpath = False
        _logger.warning('Install openssl "sudo apt-get install openssl" to use l10n_mx_facturae_lib module.')

app_xsltproc_fullpath = os.path.join(xsltproc_path, app_xsltproc) or False
try:
    if not os.path.isfile(app_xsltproc_fullpath):
        app_xsltproc_fullpath = tools.find_in_path(app_xsltproc) or False
        if not os.path.isfile(app_xsltproc_fullpath):
            app_xsltproc_fullpath = False
            _logger.warning('Install xsltproc "sudo apt-get install xsltproc" to use l10n_mx_facturae_lib module.')
except Exception, e:
    _logger.warning("Install xsltproc 'sudo apt-get install xsltproc' to use l10n_mx_facturae_lib module.")

app_xmlstarlet_fullpath = os.path.join(xmlstarlet_path, app_xmlstarlet)
# -*- 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 openerp import api, fields, models, tools
from openerp.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.one
    def _compute_loc_accuracy(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:
            wh_id = self.get_warehouse(self)
            wh = self.env['stock.warehouse'].browse(wh_id)