Powered by Odoo footer - odoo

I need to change the "Powered" in "Powered by Odoo" footer to "Made",
So the footer of my Odoo (Formerly OpenERP) Version 8.0-aab3d9f will be "Made by Odoo"
any ideas??

Instead of changing directly in the core of odoo (which is not appreciated), you can create a new module that depends on web module.
Then you can extend template web.menu_secondary from webclient_templates.xml in web module, like this:
-> _ _openerp__.py file:
{
'name': "My Module",
# for the full list
'category': 'Web',
# any module necessary for this one to work correctly
'depends': ['web'],
# always loaded
'data': ['templates.xml'],
'demo': [],
}
-> templates.xml file:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="menu_secondary" inherit_id="web.menu_secondary">
<div class="oe_footer" position="replace">
<div class="oe_footer">
Made by <span>Odoo</span>
</div>
</div>
</template>
</data>
</openerp>

First go to your Odoo web module and open below file.
addons => web => views => webclient_templates.xml
Now find this tag <div class="oe_footer"> and edit it like
<div class="oe_footer">
Made by <span>Odoo</span>
</div>
Save it and refresh your browser. Hope you get what you want.

You can use the HTML Editor of the Website module to change your site's copyright footer:
Customize > HTML Editor
Website HTML Editor Footer Copyright
As this is a fast and clean way to accomplish what you're asking for, though changes will be saved directly to working database. If you want to replicate your changes in different databases, the best approach is to make a custom module.

Related

Hide developer tool for non-administrator

I want to hide the Open Developer Tools button for non-administrators.
When I search the solution on the internet, I find the module to hide that button, but I have to pay about $50. Is there a solution to achieve those things without having to pay?
I have already deactivated developer mode. But the weird thing is, the Open Developer Tools button is hidden for admin, but is shown for non-admin.
You can alter the WebClient.DebugManager template to add a condition on the menu item.
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
<t t-extend="WebClient.DebugManager">
<t t-jquery="li" t-operation="attributes">
<attribute name="t-if">widget.is_admin</attribute>
</t>
</t>
</templates>
Then extend the web.DebugManager widget to set the value of is_admin:
odoo.define('MODULE_NAME.DebugManager', function(require) {
'use strict';
var DebugManager = require('web.DebugManager');
var session = require('web.session');
DebugManager.include({
init: function () {
this._super.apply(this, arguments);
this.is_admin = session.is_system;
},
});
});
You can check how to add a file in an asset bundle and how to extend templates in Odoo documentation.

Upgrade TinyMCE to 5, one form does not show the editor on a textarea control

I'm using Bootstrap 4.5, and have several forms all using the exact same setup to call TinyMCE 5, but one form (the most complex of course) is not showing it. I can find nothing wrong, or anything different between the way the textarea control is created. The code to load TinyMCE is being loaded in a PHP program and is therefore identical in all cases. This is the code being streamed out:
<!-- Jquery -- required for interactive parts of bootstrap and other code to function -->
<script src="../../Awards/jscode/jquery.min.js"></script>
<!-- Bootstrap core JavaScript, popper.js required for tooltips and such -->
<script src="../../Awards/jscode/popper.min.js"></script>
<script src="../../Awards/jscode/bootstrap.js"></script>
<!-- TinyMCE -->
<script src="../../Awards/jscode/tinymce/tinymce.min.js"></script>
<script language="JavaScript">
// TinyMCE, set for all textarea controls, with specific toolbar items, no menubar, etc.:
tinymce.init(
{
selector: 'textarea',
menubar: false,
branding: false,
plugins: 'code lists',
toolbar: 'undo redo | styleselect | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | code',
lists_indent_on_tab: true,
content_css: '<?php echo $Award_html_RootPath; ?>css/AwardList.css'
}); // end of TinyMCE code
</script>
This works for other forms with the same code being streamed out for each. I am stumped as to why this one form doesn't display TinyMCE. The textarea control in question is:
<div class="form-group">
<textarea name="Notes" id="Notes"
class="form-control"
style="height: 250px;"></textarea>
</div> <!-- / form-group -->
Thanks in advance for any suggestions that might point me to where the problem lies. There is a lot of JavaScript for this form but it all seems to work, it's just the TinyMCE code that doesn't want to load ... it displays as a standard textarea, no overlay for TinyMCE.
Okay, so now I feel really sheepish. I was outputting at the top of the page some styles before the header information was loaded properly, so TinyMCE wasn't seeing "standards" mode, which includes the first line of the HTML file needing to be:
<!DOCTYPE HTML>
Moved the script tags to below the code that streams the header into the page so that, among other things, the doctype tag above is the first line, and all is well. Sorry for wasting anyone's time on this.

Custom widget js doesn't recognize template from qweb

I try to test custom widget from js reference and I get error in debugger:
Error: QWeb2: Template 'some.template' not found
qweb.xml was properly set in manifest, because when I extend ListController and use another template, it works correctly.
Here is template definition, which I use in qweb.xml:
<?xml version="1.0" encoding="UTF-8"?>
<template>
<div t-name="some.template">
<span class="val"><t t-esc="widget.count"/></span>
<button>Increment</button>
</div>
</template>
I tried to change <template> -> <templates>, totally removed tag "template" but still get the same error message.
JS:
odoo.define('working.test', function (require) {
var Widget = require('web.Widget');
var Counter = Widget.extend({
template: 'some.template',
events: {
'click button': '_onClick',
},
init: function (parent, value) {
this._super(parent);
this.count = value;
},
_onClick: function () {
this.count++;
this.$('.val').text(this.count);
},
});
// Create the instance
var counter = new Counter(this, 4);
// Render and insert into DOM
counter.appendTo(".o_nocontent_help");
})
Manifest:
# -*- coding: utf-8 -*-
{
'name': "testwidget",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'description': """
Long description of module's purpose
""",
'author': "My Company",
'website': "http://www.yourcompany.com",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/12.0/odoo/addons/base/data/ir_module_category_data.xml
# for the full list
'category': 'Uncategorized',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base'],
'qweb': ['static/qweb.xml'],
# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/views.xml',
'views/web_asset.xml',
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
}
Any idea how I need to modify this template to make the widget working correctly and in which table in db odoo stores these templates?
I was running into this same issue and needed to put my QWeb code into static/src/xml/base.xml in order for Odoo to recognize it.
You can check to see if Odoo is loading the QWeb by going to this URL on your Odoo instance:
<odoo_instance>/web/webclient/qweb?mods=<my_module_name>
Such as:
localhost:8069/web/webclient/qweb?mods=test
For comparison, you can see a successful output by using mods=web to load the QWeb assets for the web module.
You can try changing
'qweb': ['static/qweb.xml'],
to
'qweb': ['static/*.xml'],
It happens with me sometimes, by specifying static xml file name, it does not render that template. But by just loading all .xml files by using *, templates are loaded.
To solve this issue I used as workaround Widget.xmlDependencies:
xmlDependencies: ['/test/static/qweb.xml']
but the main reason I think was cache in PyCharm which I didn't invalidate.
After having done some code reading, IMO, I realized the official documentation might not have pointed out clearly how to use templates in frontend.
To summarize my understanding:
The 'qweb' field in manifest is mainly designed for webclient (i.e. the backoffice), not the website. When entering webclient, a request to /web/webclient/qweb is made to retrieve all the templates of installed modules.
In order to use templates in website (i.e. frontend), synchronous and asynchronous ways both exist.
Synchronous way: Use qweb.add_template. When parameter is template content itself or a DOM node, template is loaded in a synchronous way. (While param is a URL, then it fires up an ajax request to server to fetch content.)
qweb.add_template is mentioned in https://www.odoo.com/documentation/13.0/reference/qweb.html
Asynchronous way:
Use ajax.loadXML which you can use anywhere you want to start loading template from a URL.
Use xmlDependencies which you specify in widget definition. And if you dig into the code in widget.js, you can see ajax.loadXML is being used in willStart.
There are discussions regarding qweb.add_template vs ajax.loadXML
See https://github.com/OCA/pylint-odoo/issues/186 and https://github.com/odoo/odoo/issues/20821
FYI.
I guess you may need to make sure that the js definition refers to the module name correctly
odoo.define('MODULE TECHNICAL NAME SHOULD BE HERE.test', function (require) {});
you should also register your js function with something like:
core.action_registry.add("module_name.name", Widget_Extend);
for more info https://www.odoo.com/documentation/11.0/reference/javascript_reference.html#registries
In Odoo 14 make sure
dashboard.js
odoo.define('library_managment.dashboard', function(require) {
"use strict";
// alert("hello odoo...............")
console.log("Hello My Module........!!")
var widgetRegistry = require('web.widget_registry');
var Widget = require('web.Widget');
var Counter = Widget.extend({
template: 'library_managment.template',
xmlDependencies: ['/library_managment/static/src/xml/template.xml'],
events: {
'click button': '_onClick',
},
init: function (parent, value) {
this._super(parent);
this.count = 4*9+5;
console.log("parent is", parent)
console.log("counter is..", this.count)
},
_onClick: function () {
this.count++;
this.$('.val').text(this.count);
},
});
widgetRegistry.add('library_counter', Counter);
return Counter;
});
template.xml
add this
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<div t-name="library_managment.template">
<span class="val">
<t t-esc="widget.count"/>
</span>
<button class="bg-danger">Increment</button>
</div>
</odoo>
then add js file in assets.xml inside youe views
<odoo>
<template id="assets_backend" name="Library assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/library_managment/static/src/js/dashboard.js"></script>
</xpath>
</template>
</odoo>
then add in manifest like this:
'js': ['/static/src/js/dashboard.js'],
'qweb': ['/static/src/xml/template.xml']
then inside form view add this line
<widget="library_counter"/>
I had the same problem but with "hr_org_chart" template idk why everything works fine in another computer but in mine it returned this problem, I solved it by installing this module hr-org-chart

Could not find client action (openERP 8/Odoo)

I was trying to follow this guide of building a web-module: https://doc.openerp.com/trunk/web/module/
I created the following files according to guide:
// static/src/js/first_module.js
openerp.web_example = function (instance) {
instance.web.client_actions.add('example.action', 'instance.web_example.action');
instance.web_example.action = function (parent, action) {
console.log("Executed the action", action);
};
};
openerp.py
# __openerp__.py
{
'name': "Web Example",
'description': "Basic example of a (future) web module",
'category': 'Hidden',
'depends': ['web'],
'data': ['web_example.xml'],
'js': ['static/src/js/first_module.js'],
}
web_example.xml
<!-- web_example/web_example.xml -->
<openerp>
<data>
<record model="ir.actions.client" id="action_client_example">
<field name="name">Example Client Action</field>
<field name="tag">example.action</field>
</record>
<menuitem action="action_client_example"
id="menu_client_example"/>
</data>
</openerp>
init.py is empty.
Now the "Example Client Action" link appears to the topbar of the admin-panel like it should but when I click it I get a notification saying "Could not find client action example.action"
I have checked my code few times to ensure it's similar to guide's. Am I just blind to some minor error, is there a misconception or what could be the problem? Should there be something in the init.py file? If yes, then what?
In v8 adding of static files is different as v7.
You must define static files in view, where you inheriting core views.
1. in module folder create folder named views
2. create in where file named: you_module_name.xml
3. in openerp.py add: 'data': ['views/you_module_name.xml']
4. in you_module_name.xml add:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="you_module_name assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/you_module_name/static/src/css/you_module_name.css"/>
<script type="text/javascript" src="/you_module_name/static/src/js/you_module_name.js"></script>
</xpath>
</template>
</data>
if you haven't find any way, then please follow below step for OpenERP8/odoo.
Add below contain in your web_example module.
web_example
└── views
└──document.xml
In document.xml add below contain.
<data>
<template id="web_example_assets_backend" name="web_example assets" inherit_id="web.assets_backend">`enter code here`
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_example/static/src/js/first_module.js"></script>
</xpath>
</template>
</data>
Now,modify openerp.py
openerp.py
{
'name': "Web Example",
'description': "Basic example of a (future) web module",
'category': 'Hidden',
'depends': ['web'],
'data': ['web_example.xml','views/document.xml'],
}
Thats it.
now,your js file is loaded in v8/odoo. :)
same way you can add your css file in document.xml
Thank You.
I am taking my first steps into biulding a web client, and just tried this tutorial yesterday. So I'm not sure my answer is right, but, is the name of your module "web_example"? If not, you should instantiate it with the name of your module in your js file. (it's working for me and got through the tutorial and got the timer working).
Good luck!

Dijit combobox not rendering in custom widget

I am trying to use the combobox provided by Dijit inside of a custom-made widget. I have been using Dojo's tutorial on comboboxes to guide me.
When I implement a stand-alone webpage similar to their tutorial examples, everything worked fine; but when I ported the code into my custom-made widget, it just renders the combobox as a plain HTML text box.
Here's what my custom widget's template looks like:
<div class='customWidget'>
...
<div dojoAttachPoint="mainDiv" class="mainDiv">
<div dojoType="dojo.data.ItemFileReadStore" jsId="stateStore" url="states.txt"></div>
<input dojoType="dijit.form.ComboBox"
store="stateStore"
value="California"
searchAttr="name"
name="state2" />
<button dojoAttachEvent="onclick:chooseState">OK</button>
</div>
...
</div>
In the widget code, I require the combobox and read store:
dojo.require("dijit.form.ComboBox");
dojo.require("dojo.data.ItemFileReadStore");
I also tried putting these includes in a <script/> within the custom widget (similar to the way they do it in the tutorial), but it didn't work (in fact, it appears as if the script tag wasn't even evaluated, since I couldn't reference a function I declared inside of it!)
Do you have widgetsInTemplate in your widget declaration?
dojo.declare('my.widget.Cool',[ dijit._Widget, dijit._Templated ], {
widgetsInTemplate: true,
// rest of widget JS here
});
Here's an article about including other widgets in your template.
Have you tried adding:
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.addOnLoad(function(){
dojo.parser.parse();
});
</script>
(from Dojocampus) to ensure Dojo is parsing the page? Are there any errors in your Javascript console? Is the page rendering any normal Dojo widgets?