From: http://openerpbay.blogspot.jp/2013/02/javascript-css-and-jquery-in-openerp-70.html

Hi fellows,

               Here i'm showing how can you use  JavaScript ,Css and Jquery In OpenERP 7.0.There is one cool feature added in openERP 7.0 in which you can use HTML tags inside openERP form view. This feature is not available in older version (Web 6.0 , 6.1). OpenERP already use HTML codes like <div> <H1> inside form view. But you can do much more than that you can use css and JavaScript inside form view code (OpenERP XML Code). Even more you can use JQuery also In Form View but JQuery is only work if you have old OpenERP 7 Web.In next few weeks i will show you how jquery also used in latest OpenERP 7.0 Web Code. 

                     Now, let's see how use this thing in form view. It is very if you have little knowledge of CSS and JavaScript. You can apply css as like you apply css in HTML code but only different is here you apply css in openerp form code. 

CSS

    In HTML we use css(inline) like this- Same like you can apply in OpenERP-

<p style="color:sienna;font-size:8pt;"></p> 
<field name="product_id" style="color:sienna;font-size:8pt;"/>

(This will apply css on that field but only if it in readonly form or it is in saved state.)

JavaScript

For JavaScript you can define script anyplace in code whare you can use HTML Tags.

<record id="product_normal_form_view" model="ir.ui.view">
<field name="name">product.normal.form</field>
<field name="model">product.product</field>
<field name="arch" type="xml">
<form string="Product" version="7.0">
<sheet>
<script>
alert("Hi I'm JavaScript :P ");
</script>
<field name="image_medium" widget="image" class="oe_avatar oe_left"/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name" string="Product Name"/>
</div>
<h1>
<field name="name"/>
</h1>
............
............

JQuery

For JQuery you need to apply your JQuery code inside script tag same as JavaScript. But this is not working in latest code.

<record id="product_normal_form_view" model="ir.ui.view">
<field name="name">product.normal.form</field>
<field name="model">product.product</field>
<field name="arch" type="xml">
<form string="Product" version="7.0">
<sheet>
<script>
$(document).ready(function(){
$(".oe_edit_only").click(function(){
$(this).hide();
});
});
</script>
<field name="image_medium" widget="image" class="oe_avatar oe_left"/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name" string="Product Name"/>
</div>
<h1>
<field name="name"/>
</h1>
............
............

Have a good day.

Save Paper, Save Trees.

JavaScript ,Css and Jquery In OpenERP 7.0的更多相关文章

  1. Javascript Fromdata 与jQuery 实现Ajax文件上传以及文件的删除

    前端HTML代码: <!DOCTYPE html> <html> <head> <title>ajax</title> <script ...

  2. Javascript Fromdata 与jQuery 实现Ajax文件上传

    <!DOCTYPE html> <html> <head> <title>ajax</title> <script type=&quo ...

  3. html css+div+jquery实现图片轮播

    一直想自己动手做一个图片轮播的控件,查查网上的资料大多引用已经做好的组件,其原理算法不是很清楚,于是自己用jquery写了一个.先看下效果图: 主要界面实现思路如下: 1.新建一个div宽度为100% ...

  4. 动态加载js和css的jquery plugin

    一个简单的动态加载js和css的jquery代码,用于在生成页面时通过js函数加载一些共通的js和css文件. //how to use the function below: //$.include ...

  5. jQuery plugin: Tablesorter 2.0

    http://mottie.github.io/tablesorter/docs/example-pager.htmlhttp://tablesorter.com/docs/example-pager ...

  6. css与jquery、图标字体

    *)还能这样选择 header #search input[type="text"] *)按钮常用颜色:#008cBA(字母大小写没有区别) *)清除浮动后,text-align没 ...

  7. JavaScript进阶内容——jQuery

    JavaScript进阶内容--jQuery 我们在前面的文章中已经掌握了JavaScript的全部内容,现在让我们了解一下JavaScript库 这篇文章主要是为了为大家大致讲解JavaScript ...

  8. CSS与JQuery的相关问题

    文字隐藏:p div里面的文字过长时隐藏文字: overflow:hidden; text-overflow:ellipsis; white-space:nowrap; --------------- ...

  9. 使用CSS和jQuery实现对话框

    因为项目中要显示一些对话框,但用alert显得太丑,后从网上找了一些插件,但有觉得不好用,因此自己试用CSS和jQuery写了一个对话框,代码如下: <!DOCTYPE html> < ...

随机推荐

  1. Java 请求webServce接口 不带参数

    最近对接了个webService的接口取数据,从网上良莠不齐的代码中找到了个方法, 具体作者已经记不住是谁了,现在把代码贴出来,希望可以帮到大家,代码如下,简单粗暴 public String get ...

  2. c# -- 解决FromsAuthentication上下文不存在

    使用 FormsAuthentication.HashPasswordForStoringInConfigFile("需要加密的字符串", "MD5")这个方法 ...

  3. 使用牛顿迭代法和二分法求解一个数的平方根(python语言实现)

    #牛顿迭代法 def sqrt1(x): y = 1.0 while abs(y * y - x) > 1e-6: y = (y + x/y)/2 return y #使用二分法 def sqr ...

  4. Java Web----Java Web的数据库操作(三)

    Java Web的数据库操作 前面介绍了JDBC技术和JDBC API及API的使用示例,下面详细介绍JDBC在Web中的应用. Java Web----Java Web的数据库操作(一) Java ...

  5. WM-G-MR-09模块

    WM-G-MR-09模块,该模块同时支持SDIO与SPI 模式 USI(环隆电气)WM-G-MR-09,该WiFi芯片支持802.11b/g无线网络模式,芯片体积8.2×8.4×1.35(mm),采用 ...

  6. mOByDiC E90C2600 EOBD/OBDII to RS232 gateway

    http://www.ozenelektronik.com/downs/pdf/oe90c2600.pdf Features • Compatible with EOBD/OBDII standard ...

  7. 修改gnome-shell扩展“Applications Menu”的菜单区域宽度。

    sudo打开 /usr/share/gnome-shell/extensions/apps-menu@gnome-shell-extensions.gcampax.github.com/extensi ...

  8. OSChina.net 的 Tomcat 配置 server.xml 参考

    这是目前 oschina.net 正在使用的 tomcat 的 server.xml 的配置文件内容 <Server port="9005" shutdown="S ...

  9. springBoot-自定义监听器

    package com.cx.springboot.mylistener; import org.springframework.boot.context.event.ApplicationReady ...

  10. Maven之——仓库(下)

    Maven之--仓库(下) 1.    快照版本号 Maven世界中不论什么项目或者构件都有自己的版本号. Maven在构建时检測到构件是快照版本号.而且当前构件不是最新版本号的时候.就会自己主动更新 ...