JavaScript ,Css and Jquery In OpenERP 7.0

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

时间: 2024-11-13 12:10:00

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

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

前端HTML代码: <!DOCTYPE html> <html> <head> <title>ajax</title> <script type="text/javascript" src="js/jquery.js"></script> <meta charset="utf-8" /> <style type="text/css&qu

Javascript Fromdata 与jQuery 实现Ajax文件上传

<!DOCTYPE html> <html> <head> <title>ajax</title> <script type="text/javascript" src="js/jquery.js"></script> <meta charset="utf-8" /> <style type="text/css"> fo

动态加载js和css的jquery plugin

一个简单的动态加载js和css的jquery代码,用于在生成页面时通过js函数加载一些共通的js和css文件. Java代码   //how to use the function below: //$.include('file/ajaxa.js');$.include('file/ajaxa.css'); //or $.includePath  = 'file/';$.include(['ajaxa.js','ajaxa.css']);(only if .js and .css files 

【css】jquery.pngFix.js解决透明问题

/** * -------------------------------------------------------------------- * jQuery-Plugin "pngFix" * Version: 1.2, 09.03.2009 * by Andreas Eberhard, [email protected] * http://jquery.andreaseberhard.de/ * * Copyright (c) 2007 Andreas Eberhard *

原生javaScript仿写jQuery的例子

<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>原生javaScript仿写jQuery</title> </head> <body> <div> <div class="wrap"> <input type="text" /> <input

html+css+js(+JQuery)制作扑克牌图片切换效果

要实现的效果图: 先把静态页面写出来: index.html <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>jquery制作扑克牌图片切换效果<

JavaScript强化教程——jQuery选择器

本文为 H5EDU 机构官方 HTML5培训 教程,主要介绍:JavaScript强化教程 -- jQuery选择器 jQuery 选择器 选择器 实例 选取 * $("*") 所有元素 #id $("#lastname") id="lastname" 的元素 .class $(".intro") 所有 class="intro" 的元素 element $("p") 所有 <p&

区域及分离、Js压缩、css、jquery扩展

后台管理区域及分离.Js压缩.css.jquery扩展 本系列目录:ASP.NET MVC4入门到精通系列目录汇总 有好一段时间没更新博文了,最近在忙两件事:1.看书,学习中...2.为公司年会节目做准备,由于许久没有练习双截棍了,难免生疏,所以现在临时抱佛脚.深圳最近的天气反常,许多人感冒了,我也成为其中之一,大家注意身体... 这一篇,我来简单的讲一下接下来项目中会用到的一些杂七杂八的技术. 区域及分离 在15.ASP.NET MVC入门到精通——MVC-路由中,我已经简要说明了区域的分离.

在JavaScript中重写jQuery对象的方法

jQuery是一个很好的类库,它给我们解决了很多的客户端编程,任何东西都不是万能的,当它不能满足我们的需求时我们需要对它进行重写,同时也不要影响其原有的功能或者修改其原有的功能:我现在的web应用程序大多数时候的数据交互都是通过Ajax来完成的,这样就可以将一些隐藏字段的数据保存在HTML标签的属性中,使HTML标签的代码量减少,如:ID,Timestamp等等,这些不需要用户输入但又不得不提交的字段,通过表单提交的做法是 <input name="ID" value="