packtpublishing / odoo-14-development-cookbook-fourth-edition Goto Github PK
View Code? Open in Web Editor NEWOdoo 14 Development Cookbook - Fourth Edition, published by Packt
License: MIT License
Odoo 14 Development Cookbook - Fourth Edition, published by Packt
License: MIT License
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.
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.
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
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 !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.