Ejemplo n.º 1
0
    def _generate_tutorial_articles(self):
        articles_to_create = []
        for user in self:
            self = self.with_context(lang=user.lang or self.env.user.lang)
            render_ctx = {'object': user}
            body = self.env['ir.qweb']._render(
                'knowledge.knowledge_article_user_onboarding',
                render_ctx,
                minimal_qcontext=True,
                raise_if_not_found=False)
            if not body:
                break

            welcome = _lt('Welcome %s', user.name)
            articles_to_create.append({
                'article_member_ids': [(0, 0, {
                    'partner_id': user.partner_id.id,
                    'permission': 'write',
                })],
                'body':
                body,
                'icon':
                "👋",
                'internal_permission':
                'none',
                'favorite_ids': [(0, 0, {
                    'sequence': 0,
                    'user_id': user.id,
                })],
                'name':
                welcome,
            })

        if articles_to_create:
            self.env['knowledge.article'].sudo().create(articles_to_create)
Ejemplo n.º 2
0
# -*- coding: utf-8 -*-

from contextlib import closing
import base64
import io

import odoo
from odoo.tests import common, tagged
from odoo.tools.misc import file_open, mute_logger
from odoo.tools.translate import _, _lt

TRANSLATED_TERM = _lt("Klingon")


class TestTermCount(common.TransactionCase):
    def test_count_term(self):
        """
        Just make sure we have as many translation entries as we wanted.
        """
        odoo.tools.trans_load(self.cr,
                              'test_translation_import/i18n/fr.po',
                              'fr_FR',
                              module_name='test_translation_import',
                              verbose=False)
        translations = self.env['ir.translation'].search([
            ('lang', '=', 'fr_FR'),
            ('src', '=',
             '1XBUO5PUYH2RYZSA1FTLRYS8SPCNU1UYXMEYMM25ASV7JC2KTJZQESZYRV9L8CGB'
             ),
        ],
                                                         order='type')
Ejemplo n.º 3
0
        for session in sessions_to_check:
            session._check_session_timing()
        return super(pos_session, self).open_frontend_cb()


ORDER_FIELDS = [
    'date_order', 'user_id', 'lines', 'payment_ids', 'pricelist_id',
    'partner_id', 'session_id', 'pos_reference', 'sale_journal',
    'fiscal_position_id'
]
LINE_FIELDS = [
    'notice', 'product_id', 'qty', 'price_unit', 'discount', 'tax_ids',
    'tax_ids_after_fiscal_position'
]
ERR_MSG = _lt(
    'According to the French law, you cannot modify a %s. Forbidden fields: %s.'
)


class pos_order(models.Model):
    _inherit = 'pos.order'

    l10n_fr_hash = fields.Char(string="Inalteralbility Hash",
                               readonly=True,
                               copy=False)
    l10n_fr_secure_sequence_number = fields.Integer(
        string="Inalteralbility No Gap Sequence #", readonly=True, copy=False)
    l10n_fr_string_to_hash = fields.Char(compute='_compute_string_to_hash',
                                         readonly=True,
                                         store=False)
Ejemplo n.º 4
0
import requests
import json
import datetime
import logging
import uuid
import re

from odoo import models, api, fields, SUPERUSER_ID
from odoo.exceptions import AccessError, UserError
from odoo.tools.translate import _, _lt

_logger = logging.getLogger(__name__)

ERROR_MESSAGES = {
    '409':
    _lt("Problem Updating Account(409): We could not update your account because the end site is experiencing technical difficulties."
        ),
    '411':
    _lt("Site No Longer Available (411):The site no longer provides online services to its customers.  Please delete this account."
        ),
    '412':
    _lt("Problem Updating Account(412): We could not update your account because the site is experiencing technical difficulties."
        ),
    '415':
    _lt("Problem Updating Account(415): We could not update your account because the site is experiencing technical difficulties."
        ),
    '416':
    _lt("Multiple User Logins(416): We attempted to update your account, but another session was already established at the same time.  If you are currently logged on to this account directly, please log off and try after some time"
        ),
    '418':
    _lt("Problem Updating Account(418): We could not update your account because the site is experiencing technical difficulties. Please try later."
        ),