Giter Club home page Giter Club logo

odoo-14-development-cookbook-fourth-edition's Issues

Chapter 15 : Create a custom widget - Problem when Form is in readonly mode

There is a mismatch when you select a pill_no equals to 0. This adds a o_field_empty class.

To avoid this I suggested this :

<templates>
    <t t-name="FieldColorPills">
        <t t-foreach="widget.totalColors" t-as='pill_no'>
            <span t-attf-class="o_color_pill o_color_#{pill_no+1} #{widget.value === pill_no+1 and 'active' or ''}" t-attf-data-val="#{pill_no+1}"
            data-toggle="tooltip" data-placement="top" t-attf-title="This color is used in #{widget.colorGroupData[pill_no] or 0 } books."/>
        </t>
    </t>
</templates>

Please let me know if there is a better way.

chapter 3

thise error。
raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing file:/f:/seafile1/programe/python/odoo/odoo14e111/odoo14e/odoo/addonsofmy/my_stock_request/views/views.xml:3, near

Library Books
library.book
tree,form

thanks.

Chapter 13 - Group authentication on controllers

Hi there, I wasn't able to get this to work without overriding the authenticate method of odoo, since it couldn't handle the extra parameters passed through.

This is what I had to do to make it work, might want to add some extra comments that its not possible just using the snippets given in the book.

from odoo import models, exceptions
from odoo.http import request
from odoo import http
import werkzeug.exceptions
import logging

_logger = logging.getLogger(__name__)


class IrHttp(models.AbstractModel):
    _inherit = ['ir.http']

    @classmethod
    def _auth_method_base_group_user(cls):
        cls._auth_method_user()
        if not request.env.user.has_group('base.group_user'):
            raise exceptions.AccessDenied()

    # this is for the exercise
    @classmethod
    def _auth_method_groups(cls, group_xmlids=None):
        cls._auth_method_user()
        if not any(map(request.env.user.has_group, group_xmlids.split(',') or [])):
            raise exceptions.AccessDenied()

    @classmethod
    def _authenticate(cls, endpoint):
        auth_method = endpoint.routing["auth"]
        if request._is_cors_preflight(endpoint):
            auth_method = 'none'
        try:
            if request.session.uid:
                try:
                    request.session.check_security()
                    # what if error in security.check()
                    #   -> res_users.check()
                    #   -> res_users._check_credentials()
                except (exceptions.AccessDenied, http.SessionExpiredException):
                    # All other exceptions mean undetermined status (e.g. connection pool full),
                    # let them bubble up
                    request.session.logout(keep_db=True)
            if request.uid is None:
                parameters = None
                method_name = auth_method
                if '(' in auth_method:
                    end = auth_method.find('(')
                    method_name = auth_method[:end]
                    parameters = auth_method[end+1:-1]
                    getattr(cls, "_auth_method_%s" % method_name)(parameters)
                else:
                    getattr(cls, "_auth_method_%s" % auth_method)()
        except (exceptions.AccessDenied, http.SessionExpiredException, werkzeug.exceptions.HTTPException):
            raise
        except Exception:
            _logger.info("Exception during request Authentication.", exc_info=True)
            raise exceptions.AccessDenied()
        return auth_method

odoo-bin: error: unrecognized parameters: '–i base' ubuntu 18.4

in the installation section, everything goes well until the last line : python3 odoo-bin -d odoo-test –i base --addonspath=addons --db-filter=odoo-test$
i get : odoo-bin: error: unrecognized parameters: '–i base' ubuntu 18.4
any help please? i have searches too much and i could not find a solution, please some help !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.