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. python3-开发进阶Flask的基础

    一.概述 最大的特点:短小精悍.可拓展强的一个Web框架.注意点:上下文管理机制,依赖wsgi:werkzurg 模块 二.前奏学习werkzurg 先来回顾一个知识点:一个类加括号会执行__init ...

  2. [SimpleOJ236]暴风雨

    题目大意: 给你一棵n个点的树,以及m+q条信息. m条描述点a到b有边直接相连. q条描述点a和点b的LCA为c. 问有多少符合条件的以1为根的树. 思路: 状压DP. e[i]记录需要与点i直接相 ...

  3. [bzoj1025][SCOI2009]游戏 (分组背包)

    Description windy学会了一种游戏.对于1到N这N个数字,都有唯一 且不同的1到N的数字与之对应.最开始windy把数字按顺序1,2,3,……,N写一排在纸上.然后再在这一排下面写上它们 ...

  4. Java高级架构师(一)第43节:Varnish简介、安装和基本使用

    第一部分:Varnish简介 Varnish是一款开源的.高性能的HTTP加速器和反向代理服务器. Varnish反向代理的能力远不如Nginx. Varnish主要作用是HTTP的加速器,主要通过缓 ...

  5. asp.net调用存储过程2

    创建一个只有输入参数的存储过程 create procedure proc_user@name varchar(20),@Password varchar(100)as select * from l ...

  6. codeforces VK Cup 2015 - Qualification Round 1 B. Photo to Remember 水题

    B. Photo to Remember Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/522/ ...

  7. SpringMVC 3.1.1版本下的单元测试WEB-INF路径问题

    假设Spring配置文件为applicationContext.xml 一.Spring配置文件在类路径下面 在Spring的java应用程序中,一般我们的Spring的配置文件都是放在放在类路径下面 ...

  8. pom通用依赖

    <dependencies><!--common--><dependency><groupId>com.google.guava</groupId ...

  9. CentOS 6.9搭建的网关服务器不经过静态路由表的问题解决(没有开启路由转发功能)

    场景: 1.使用CentOS 6.9搭建的网关服务器,下面的机器都设置用这个网关,搭建参考:http://www.cnblogs.com/EasonJim/p/8289618.html 2.配置了静态 ...

  10. VS2010安装HTML5插件

    步骤: 1. 下载 插件 2.拷贝文件里面德尔html_5.xsd到 D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packa ...