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

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

Related

Pass id or class name to points(ticks) inside canvas

I am using react-chartjs-2 to render charts and on clicking the active point it gets redirected to some other page.
<Line
id={'chartid'}
data={data}
options={options}
getElementAtEvent={dataset => {
// redirects to some other page
}}
/>
Sample chart
We are doing automation testing and need to check if click is working or not.
Is there any option to add id/class to active elements inside the rendered canvas. Can anyone help?
AFAIK every element has got datasetIndex and index properties related to the drawn dataset.
Emitting the click event on the canvas (a specific point) you could check that dataset index and index are what you are expecting

How to put a menu Icon in odoo 9?

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.

Hit / Stat counter in a rails app

I thought a hit counter would be simple enough as it's a pretty basic piece of code to insert to a html page, however when I add statcounter to my rails app, all the navigation links break. Can anyone advise me as to the best way to insert something like this to my app?
It works but when I click on a nav link, it just displays the hit counter on a blank page unless I reload the page or , if I use the invisible hit counter, it displays an empty page for whatever nav link I click.
application.html.erb
<!--
* Statcounter to monitor visitors, etc to my webapp
* #reference https://statcounter.com
-->
<!-- Start of StatCounter Code for Default Guide -->
<script type="text/javascript">
var sc_project=11051099;
var sc_invisible=0;
var sc_security="0e87dbf6";
var scJsHost = (("https:" == document.location.protocol) ?
"https://secure." : "http://www.");
document.write("<sc"+"ript type='text/javascript' src='" +
scJsHost+
"statcounter.com/counter/counter.js'></"+"script>");
</script>
<noscript><div class="statcounter"><a title="shopify
analytics" href="http://statcounter.com/shopify/"
target="_blank"><img class="statcounter"
src="//c.statcounter.com/11051099/0/0e87dbf6/0/"
alt="shopify analytics"></a></div></noscript>
<!-- End of StatCounter Code for Default Guide -->

Simplecart additional hidden item attributes

I am trying to add an additional, hidden field to my simplecart items when using the simpleCart_shelfItem div. I've tried hidden inputs, additional spans, and can't get my attribute to show up in the JSON that's passed by Simplecarts form checkout.
Nothing fancy when I init simplecart:
// Init shopping cart
script(type='text/javascript')
simpleCart({
checkout: {
type: "SendForm",
url: "/cart/checkout"
},
currency: "USD",
cartStyle: "table"
});
Here's where I load a shelf item (note that this is using the Jade engine, but HTML is as expected):
div.simpleCart_shelfItem
p.item_name My Special Item
input.item_Quantity(type='text', value='1')
input.item_secretId(type='hidden', value='A hidden identifier')
br
span.item_price $0.99
br
a.item_add(href="javascript:;") Add to Cart
I've also tried using:
span.item_secretId A hidden identifier
And when I pass the cart to /cart/checkout secretId is nowhere to be found when I do a console log of req.body in my server-side code:
Checkout passed with: {"currency":"USD","shipping":"0","tax":"0","taxRate":"0","itemCount":"1","item_name_1":"4x6 Print","item_quantity_1":"4","item_price_1":"0.99","item_options_1":""}
I've seen the ability to add custom columns to the cart in the API docs, but I don't want this field to show up in the cart, it's strictly internal to facilitate server-side processing.
It's not particularly pretty, but I solved this by using div tags around my new data elements, and then hiding them in a stylesheet like this
HTML:
input(class="item_internalId", type='text', value='1234')
CSS:
input.item_internalId {
display: none;
}

Joomla 2.5 set module only on homepage

Hello am developer no administrator i have problem with my website (e-shop).
I use HikaShop componetn on my site and want to show last products on home page.
In Home page i add module and set position, and set in configuration to be visible only on HOME page. But dont work. I configure in administration where is visible where is not visible.
I try in my index manual to add
<div id="wraper">
<jdoc:include type="message" />
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault())
{?>
<jdoc:include type="modules" name="position-10" /><?php
} ?>
<jdoc:include type="component" />
</div><!--END OF WRAPER -->
I have top menu (HOME, AboutUs, Product, Contact) and when i click on About us and other page in top menu that module is not visible work fine. But on site i have sidebar where i show product categories. And there is problem, when i click on catetogy last product module is visible there.
Example:
--> TOP Menu
example.com -> TRUE = Module Last Product is Visible
example.com/index.php/abut-us -> FALSE = Module Last
Product is not Visible
example.com/index.php/product -> FALSE = Module Last
Product is not Visible
example.com/index.php/contact -> FALSE = Module Last
Product is not Visible
--> SIDEBAR
example.com/category/17-fishing-road -> TRUE = Module Last
Product is Visible
in all category is visible but i configure only on homepage
And in all sidebar is visible. Any idea how to fix this and put visible only on
example.com/index.php (HOMEPAGE)
Try this:
if(JRequest::getVar('view') == "frontpage" ) {
//You are in!
}
else {
//You are out!
}
The assignment of modules is done via the Module Manager, not the template index.php
Sp, go to the Module Manager (backend), open the module you want to assign, in the bottom left you can select which menu items you want to assign it to.
If it doesn't work using this method, then there must be something wrong with your site.
Hope this helps