How to put a menu Icon in odoo 9? - menuitem

I want to put a menu icon for the hr_attendance addon in odoo 9.
I will explain the steps that i have done:
Create hr_attendance_extend an put it in addon_extra
Import the original addon. This is "init.py":
import hr_attendance
Create the css and put the icon. This is a piece of the file "static/src/css/slider.css":
...
.oe_systray .oe_attendance_signout {
float:right;
height: 32px;
width: 32px;
background: url(/hr_attendance_extend/static/src/img/emp-in32.png);
cursor: pointer;
}
...
Link the file with the addon. This is the file ''views/hr_attendance.xml":
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="hr_attendance assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/hr_attendance_extend/static/src/css/slider.css"/>
</xpath>
</template>
</data>
</openerp>
Put the new files in the new addon. This is part of the file "openerp.py":
{
...
'depends': ['hr_attendance'],
'data': [
'hr_attendance.xml',
'views/hr_attendance.xml',
],
'demo': [],
'test': [],
'installable': True,
'auto_install': False,
#web
'qweb' : ["static/src/xml/attendance.xml"],
}
Put the container for the menu. This is the file ''static/src/xml/attendance.xml":
<template>
<t t-name="AttendanceSlider">
<li class="oe_attendance_status oe_attendance_nosigned" data-toggle="tooltip">
<div class="oe_attendance_signout"></div>
</li>
</t>
</template>
In the original addon (hr_attendance) there is a function that it pushes the icon to the menu (I think).
There is in the file static/src/js/attendance.js and that is the line in question:
SystrayMenu.Items.push(AttendanceSlider);
That's all.
I don't know if I am missing something. The code of the icon appears in the html, but there is with 'style="display: none"'
Edit:
If I change the css file putting the property "display: block !important", then, the icon appears in the menu, but that fix is not the correct solution.

I found the solution for another problem which shares the same solution as here.
These are the steps for a new user:
Log in as administrator
Employees > Employees > Create button (Fill the name)
Select the "HR Settings" tab > Related User -> Create and edit (Fill the name and email).
Save the user and save the employee.
Go to Developer mode (User menu > About > Activate the developer mode)
Settings > User > Select the new created user > Edit > Mark the option "Attendances"
Save the user.
Now, the icon appears.

Related

Add a file upload button to chat screen

My RN 0.61.5 app is running the react-native-gifted-chat 0.13.0. Here is the render which is pretty plain:
render() {
console.log("In GiftedChat render : ");
return (
<GiftedChat
messages={this.state.messages}
onSend={messages => this._onSend(messages)}
user={{_id: this.state.myself.id,
name: this.state.myself.name,
avatar: this.state.myself.user_data.avatar}}
/>
);
}
I would like to add a file upload button (which can open gallery or file manager) by the typing text box allowing user to upload an image or video file. How can I do that? I have searched online and gone over the doc but did not find a way/hook to add a button to the chat screen. Many thank.
There is a prop called renderActions() in gifted chat docs. It adds a custom action button on the left of the message composer. I have implemented image uploading button by using this.
<GiftedChat
messages={this.state.messages}
onSend={this.send}
...
renderActions={() => (
<React.Fragment>
<ImgPicker setmsgImgUrl={this.setmsgImgUrl} />
</React.Fragment>
)}
/>
I have created the ImgPicker component by using codes in the expo docs image picker.
If you want to see the ImgPicker component code, here is the link.
Github link for the ImgPicker Component Code

Set default text for RichHtmlField

I am using SharePoint Designer 2013 to edit a page layout file (*.aspx). I tried to set a default text to a RichHtmlField using its "Html" property, but it is not working. I tried the "Text" property and it's also not working. How do I make it work?
<PublishingWebControls:RichHtmlField id="PageContent" FieldName="PublishingPageContent" MinimumEditHeight="400px" DisableInputFieldLabel="true" Html="<html><span><p>Objectives</p></span></html>" runat="server"/>
Try using the Publishing:HtmlEditor This will allow you to set the HTML property. I am using this in a custom application page in Visual Studio so i have no idea if this will work in SharePoint Designer. My need was to have the default html editing textbox. It works on our environment like this:
<Publishing:HtmlEditor ID="htmlEditor" BorderWidth="1" BorderStyle="Solid" runat="server" />
<div ID="HtmlEditorTextBox" visible="false" runat="server" style="background-color: #F0F0F0; color: rgb(84, 84, 84); border:1px solid gray;width:400px;height:200px;overflow:auto;"></div>
In code-behind i can address the editor like this:
htmlEditor.Field = new RichHtmlField();
htmlEditor.Field.HasInitialFocus = false;
htmlEditor.Field.ControlMode = Microsoft.SharePoint.WebControls.SPControlMode.New;
htmlEditor.Field.EnableViewState = true;
htmlEditor.Field.AllowReusableContent = false;
htmlEditor.Field.MinimumEditHeight = "200px";
htmlEditor.Html = "<b>Hello</b>";
HtmlEditorTextBox.InnerHtml = "<b>Hello</b>";
Make sure you have this include in your aspx page:
<%#Register TagPrefix="Publishing" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.Publishing.WebControls"%>

Django - WYSIWYG Editor not displaying in template

I am now using django ckeditor as a WYSIWYG editor for adding product information,
previously I was using Summernote, but after moving to production the widget would not display in my template (at all, just a big white space) so I decided to try ckeditor.
However with django CKEditor all I see is a normal textarea, rather than the WYSIWYG editor.
The source code from the template is as follows:
<div class="col-sm-2"> Description:</div><div class="col-sm-10"><div class="django-ckeditor-widget" data-field-id="id_description" style="display: inline-block;">
<textarea cols="40" id="id_description" name="description" rows="10" data-processed="0" data-config='{"toolbar_Basic": [["Source", "-", "Bold", "Italic"]], "language": "en-us", "height": 291, "width": 835, "toolbar": "Full", "skin": "moono", "toolbar_Full": [["Styles", "Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker", "Undo", "Redo"], ["Link", "Unlink", "Anchor"], ["Image", "Flash", "Table", "HorizontalRule"], ["TextColor", "BGColor"], ["Smiley", "SpecialChar"], ["Source"]], "filebrowserWindowWidth": 940, "filebrowserWindowHeight": 725}' data-external-plugin-resources='[]' data-id="id_description" data-type="ckeditortype"></textarea>
My installation process was very simple: install django-ckeditor, (jquery already), add to installed apps, collectstatic, change the widget in my modelform, refresh server.
I am sure there is a simple thing I am missing here but I have no idea what it could be!
Any ideas?
You didn't mention if this is in admin or custom view.
If this is in a custom view check that both the widget .js file and jQuery are linked correctly in your page.
If it's in admin you probably don't have jQuery linked there and should add this to your settings.py:
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
If both do not help share what errors your JS console gives you

How do I load a SharePoint 2013 discussion page in Reply mode?

I have a SharePoint 2013 Community Site that is used for discussions. I want to create a link to a specific discussion item that will open the discussion item in "Reply" mode, i.e. the mode you get to if you click the Reply button just under the Discussion item text. I want to do this because the Reply mode text entry box is right under the discussion item text where it is obvious to see. The default reply text entry box is at the bottom of the page and it scrolls off the page if there are already a lot of replies on the topic.
Here is the default view on a Discussion item
If you click the "Reply" link here
then the a Reply Pane opens up right under the discussion item text.
But what I want to do it to be able to send a URL by mail that will open the discussion thread already in Reply mode.
The solution I found to do this consisted of customizing the /Lists/Community Discussion/Flat.aspx with client-side script as follows.
First insert a Script Editor into the page (Settings -> Edit Page -> Add a Web Part -> Categories -> Media and Content -> Content Editor -> Script Editor.
Next upload a copy of jquery.min.js to the Site Assets library.
Then add the following code to the Script Editor using Edit Snippet:
<script src="/SiteAssets/jquery.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
if (location.search.indexOf('replyMode=1') != -1)
{
openReplyPane();
}
});
function openReplyPane()
{
var mouseEvent = new MouseEvent("click", {
'bubbles': true,
'cancelable': true,
'view': window,
'detail': 0,
'screenX': 0,
'screenY': 0,
'clientX': 0,
'clientY': 0,
'ctrlKey': false,
'altKey': false,
'shiftKey': false,
'metaKey': false,
'button': 0,
'relatedTarget': null,
'currentTarget': 'form#aspnetForm',
'srcElement': 'a#commandBar0-reply-Link.ms-secondaryCommandLink',
'target':'a#commandBar0-reply-Link.ms-secondaryCommandLink',
'timeStamp':1425842811416,
'toElement':'a#commandBar0-reply-Link.ms-secondaryCommandLink'
});
var replyLink = document.getElementById('commandBar0-reply-Link');
replyLink.dispatchEvent(mouseEvent);
}
</script>
Save your changes.
Now if you add the string "&replyMode=1" to the end of the URL for the discussion item, you can navigate to the post, and the Reply pane will be automatically opened for the user.

Odoo 8.. Menu Item not Shown and also No Module Data

Module is installed properly after writing the code in xml but menu item id not appearing above in parent..
_init__.py
import sea
_openerp__.py
# -*- coding: utf-8 -*-
{
'name': "vessel Tracker",
'summary': """Vssel Finder""",
'description': """
Module for tracking vessels:
It handles millions of vessel position records daily. Our API allows you to integrate our data into your application or website. You can harness all this data, along with port calls, ship particulars etc. to build powerful applications for real-time, targeted intelligence.
Get started by selecting an option from the available services below. Please contact us if you can't find what you are looking for.
""",
'author': "RANA",
'website': "http://www.my-cricket.weebly.com",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
# for the full list
'category': 'Fleet',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base'],
# always loaded
'data': [
# 'security/ir.model.access.csv',
#'track.xml',
#'act_data.xml',
'sea_view.xml',
],
# only loaded in demonstration mode
'demo': [
],
'js': ["static/src/sea.js"],
}
My sea.py file
from openerp import models, fields,api
import canvas
import math
class Sea(models.Model):
_name = 'vessel.track'
File of seamodule/static/src/sea.js
<script type="text/javascript">
// Map Size
var width='800'; // width of the embedded map in pixels (min. 600 px) or percentage (default=600px)
var height='500'; // height of the embedded map in pixels (min. 400 px) (default=400px)
// Map View (does not work if Ship Selection is used)
var latitude='40.0'; // coordinates of the map center in decimal degrees (not mandatory)
var longitude='2.0';
var zoom='2'; // map zoom level (between 2 and 17)
// Ship selection
// IMPORTANT: USE ONLY ONE OF THE FOLLOWING OPTIONS
// Option 1 – by MMSI
var mmsi='xxxxxxxxx'; // center map over selected vessel specified by MMSI
var show_track=true; // show track of the selected ship
// Option 2 – by IMO
var imo='xxxxxxx'; // center map over selected vessel specified by IMO
var show_track=true; // show track of the selected ship
// Option 3 – display user fleet ships
var fleet='your fleet id'; // your fleet key (default is false)
var fleet_hide_old_positions=false; // Hide ships with old positions (default is false)
// Auxiliary parameters
var names=false; // always display ship names (default is false)
var click_to_activate=true; // user has to click on the map before zooming with mouse wheel
var store_position=false; // store the last position of the map (default is false, does not work when ship selection is used
var default_maptype=1; // change default map type: 1 - google.maps.MapTypeId.ROADMAP, 2 - google.maps.MapTypeId.SATELLITE
var map_style=[ // use this tool for custom map styling
{"featureType": "landscape.natural.landcover", "stylers": [{ "hue": "#ffaa00" }]},
{"featureType": "water", "stylers": [{ "hue": "#00a1ff" },{ "saturation": 91 },{ "lightness": -18 }]}];
</script>
And sea_view.xml
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- top level menu: no parent -->
<menuitem id="main_sea_menu" name="Sea Map"/>
<!-- A first level in the left side menu is needed
before using action= attribute -->
<menuitem id="sea_menu" name="Sea Map" parent="main_sea_menu"/>
<!--the following menuitem should appear *after*
its parent openacademy_menu and *after* its
action course_list_action -->
<!--<menuitem id="maps_menu" name="Sea Map" parent="sea_menu" action="sea_list_action"/>
Full id location:
action="openacademy.course_list_action" It is not required when it is the same module -->
<!-- -<menuitem id="configuration_menu" name="Configuraiton" action="configuration_list_action"/>
<record model="ir.actions.act_window" id="action_sea_map">
<field name="name">Ideas</field>
<field name="res_model">idea.idea</field>
<field name="view_mode">tree,form</field> -->
<template>
<html>
<head>
<script type="text/javascript" src="static/src/sea.js"/>
</head>
</html>
</template>
</data>
</openerp>
Please guide that module installs correctly but data as well as menu item in parent is not shown
Thanks