コード例 #1
0
ファイル: start.py プロジェクト: Tecnativa/odoo
    def run(self, cmdargs):
        parser = argparse.ArgumentParser(
            prog="%s start" % sys.argv[0].split(os.path.sep)[-1],
            description=self.__doc__
        )
        parser.add_argument('--path', default=".",
            help="Directory where your project's modules are stored (will autodetect from current dir)")
        parser.add_argument("-d", "--database", dest="db_name", default=None,
                         help="Specify the database name (default to project's directory name")


        args, unknown = parser.parse_known_args(args=cmdargs)

        # When in a virtualenv, by default use it's path rather than the cwd
        if args.path == '.' and os.environ.get('VIRTUAL_ENV'):
            args.path = os.environ.get('VIRTUAL_ENV')
        project_path = os.path.abspath(os.path.expanduser(os.path.expandvars(args.path)))
        module_root = get_module_root(project_path)
        db_name = None
        if module_root:
            # started in a module so we choose this module name for database
            db_name = project_path.split(os.path.sep)[-1]
            # go to the parent's directory of the module root
            project_path = os.path.abspath(os.path.join(project_path, os.pardir))

        # check if one of the subfolders has at least one module
        mods = self.get_module_list(project_path)
        if mods and '--addons-path' not in cmdargs:
            cmdargs.append('--addons-path=%s' % project_path)

        if not args.db_name:
            args.db_name = db_name or project_path.split(os.path.sep)[-1]
            cmdargs.extend(('-d', args.db_name))

        # TODO: forbid some database names ? eg template1, ...
        try:
            _create_empty_database(args.db_name)
            odoo.tools.config['init']['base'] = True
        except DatabaseExists as e:
            pass
        except Exception as e:
            die("Could not create database `%s`. (%s)" % (args.db_name, e))

        if '--db-filter' not in cmdargs:
            cmdargs.append('--db-filter=^%s$' % args.db_name)

        # Remove --path /-p options from the command arguments
        def to_remove(i, l):
            return l[i] == '-p' or l[i].startswith('--path') or \
                (i > 0 and l[i-1] in ['-p', '--path'])
        cmdargs = [v for i, v in enumerate(cmdargs)
                   if not to_remove(i, cmdargs)]

        main(cmdargs)
コード例 #2
0
    def run(self, cmdargs):
        parser = argparse.ArgumentParser(prog="%s start" %
                                         sys.argv[0].split(os.path.sep)[-1],
                                         description=self.__doc__)
        parser.add_argument(
            '--path',
            default=".",
            help=
            "Directory where your project's modules are stored (will autodetect from current dir)"
        )
        parser.add_argument(
            "-d",
            "--database",
            dest="db_name",
            default=None,
            help=
            "Specify the database name (default to project's directory name")

        args, unknown = parser.parse_known_args(args=cmdargs)

        # When in a virtualenv, by default use it's path rather than the cwd
        if args.path == '.' and os.environ.get('VIRTUAL_ENV'):
            args.path = os.environ.get('VIRTUAL_ENV')
        project_path = os.path.abspath(
            os.path.expanduser(os.path.expandvars(args.path)))
        module_root = get_module_root(project_path)
        db_name = None
        if module_root:
            # started in a module so we choose this module name for database
            db_name = project_path.split(os.path.sep)[-1]
            # go to the parent's directory of the module root
            project_path = os.path.abspath(
                os.path.join(project_path, os.pardir))

        # check if one of the subfolders has at least one module
        mods = self.get_module_list(project_path)
        if mods and '--addons-path' not in cmdargs:
            cmdargs.append('--addons-path=%s' % project_path)

        if not args.db_name:
            args.db_name = db_name or project_path.split(os.path.sep)[-1]
            cmdargs.extend(('-d', args.db_name))

        # TODO: forbid some database names ? eg template1, ...
        try:
            _create_empty_database(args.db_name)
            _add_timescale_extention(args.db_name)
        except DatabaseExists, e:
            pass
コード例 #3
0
ファイル: start.py プロジェクト: ADS101/odoo
    def run(self, cmdargs):
        parser = argparse.ArgumentParser(
            prog="%s start" % sys.argv[0].split(os.path.sep)[-1],
            description=self.__doc__
        )
        parser.add_argument('--path', default=".",
            help="Directory where your project's modules are stored (will autodetect from current dir)")
        parser.add_argument("-d", "--database", dest="db_name", default=None,
                         help="Specify the database name (default to project's directory name")


        args, unknown = parser.parse_known_args(args=cmdargs)

        project_path = os.path.abspath(os.path.expanduser(os.path.expandvars(args.path)))
        module_root = get_module_root(project_path)
        db_name = None
        if module_root:
            # started in a module so we choose this module name for database
            db_name = project_path.split(os.path.sep)[-1]
            # go to the parent's directory of the module root
            project_path = os.path.abspath(os.path.join(project_path, os.pardir))

        # check if one of the subfolders has at least one module
        mods = self.get_module_list(project_path)
        if mods and '--addons-path' not in cmdargs:
            cmdargs.append('--addons-path=%s' % project_path)

        if not args.db_name:
            args.db_name = db_name or project_path.split(os.path.sep)[-1]
            cmdargs.extend(('-d', args.db_name))

        # TODO: forbid some database names ? eg template1, ...
        try:
            _create_empty_database(args.db_name)
        except DatabaseExists, e:
            pass
コード例 #4
0
ファイル: start.py プロジェクト: rapidgrps/eagle-1.0-backup
    def run(self, cmdargs):
        parser = argparse.ArgumentParser(prog="%s start" %
                                         sys.argv[0].split(os.path.sep)[-1],
                                         description=self.__doc__)
        parser.add_argument(
            '--path',
            default=".",
            help=
            "Directory where your project's modules are stored (will autodetect from current dir)"
        )
        parser.add_argument(
            "-d",
            "--database",
            dest="db_name",
            default=None,
            help=
            "Specify the database name (default to project's directory name")

        args, unknown = parser.parse_known_args(args=cmdargs)

        project_path = os.path.abspath(
            os.path.expanduser(os.path.expandvars(args.path)))
        module_root = get_module_root(project_path)
        db_name = None
        if module_root:
            # started in a module so we choose this module name for database
            db_name = project_path.split(os.path.sep)[-1]
            # go to the parent's directory of the module root
            project_path = os.path.abspath(
                os.path.join(project_path, os.pardir))

        # check if one of the subfolders has at least one module
        mods = self.get_module_list(project_path)
        if mods and '--addons-path' not in cmdargs:
            cmdargs.append('--addons-path=%s' % project_path)

        if not args.db_name:
            args.db_name = db_name or project_path.split(os.path.sep)[-1]
            cmdargs.extend(('-d', args.db_name))

        # TODO: forbid some database names ? eg template1, ...
        try:
            _create_empty_database(args.db_name)
        except DatabaseExists as e:
            pass
        except Exception as e:
            die("Could not create database `%s`. (%s)" % (args.db_name, e))

        if '--db-filter' not in cmdargs:
            cmdargs.append('--db-filter=^%s$' % args.db_name)

        # Remove --path /-p options from the command arguments
        def to_remove(i, l):
            return l[i] == '-p' or l[i].startswith('--path') or \
                (i > 0 and l[i-1] in ['-p', '--path'])

        cmdargs = [
            v for i, v in enumerate(cmdargs) if not to_remove(i, cmdargs)
        ]

        main(cmdargs)
コード例 #5
0
import os
from datetime import datetime

# Needs Jinja 2.10
from jinja2 import Environment, FileSystemLoader, select_autoescape

from odoo import fields, models
from odoo.modules.module import get_module_root

from odoo.addons.base.models.res_bank import sanitize_account_number

from ..components.api import PayNetDWS

import zeep  # isort:skip

MODULE_PATH = get_module_root(os.path.dirname(__file__))
INVOICE_TEMPLATE_2013 = "invoice-2013A.xml"
INVOICE_TEMPLATE_2003 = "invoice-2003A.xml"
TEMPLATE_DIR = [MODULE_PATH + "/messages"]

DOCUMENT_TYPE = {"out_invoice": "EFD", "out_refund": "EGS"}


class PaynetInvoiceMessage(models.Model):
    _name = "paynet.invoice.message"
    _description = "Paynet shipment send to service"

    service_id = fields.Many2one(
        comodel_name="paynet.service",
        string="Paynet Service",
        required=True,