Search

Saturday, 31 October 2015

Odoo QWEB Reports: Tips & Trick


List of HTML elements those  are not supported directly in Qweb report. 


1) How to Use Space In Qweb Report?



   Solution - 1:
                  <![CDATA[&nbsp;]]>
 

Any HTML element can be use inside CDATA[] list which is not supported directly.

 


   Solution - 2:

                           &#160;


2) How to User > or < sign inside if condition?

    Sol.

    These conditional operators are not supported directly in Qweb or any XML file.

        A.  Instead of > symbol you have to use &gt;
        B.  Instead of < symbol you have to use &lt; 


3) How to Print & sign inside message or in any condition?


     Sol.    &amp;


4) How to use Else condition in QWeb report?

Else condition you  can use same IF Condition format, you have to add not  or ! sign before your condition starts.


 For Eg. We have partner_id fields inside our model/Object. we want to check is partner_id or not both way we will see here.

      A. <t t-if ="o.partner_id">  your code</t>

      B. <t t-if="not o.partner_id"> your code</t> 

This will work like else, likewise you can achieve else part by using this format.


 5) What is different between t-field and t-esc template inside QWeb report?



t-field: This is template defined inside odoo's standard module as XML record.
There are several templates already define inside base module for report. those are ready to use.

i) This template you can only use for the browse object/Records set which is coming from main loop.

For eg: At top we are iterating loop for-each="docs" t-as="o"

This template is useful to fetch information from the object directly.

ii) This only can be used inside HTML elements like <p> <span> <tr> etc..



t-esc: This is also the template as t-field. the behaviour of this template is  different than t-field.

i) This template used to call any function from the related parser class to fetch some runtime or dynamic information.
  A. Call Any function from parser.

      
  B. Define In line function or anonymous function.

    


ii) This template can  use inside t (Template) tag or any other HTML tag.

For eg:

        






Many More to come will update soon!








 

Wednesday, 7 January 2015

Configure odoo v8 as developement envirnment in Ubuntu Step by step.



Configuration with Ubuntu System. 




Step 1 : sudo apt-get update

Step 2: Download the source code of odoo. from below link.

Copy and paste this below line into your terminal will download the odoo v8 stable code.

 git clone https://www.github.com/odoo/odoo --branch 8.0


Step 3 : Install the required Library in your system those are already used in odoo standard modules.

Copy and paste this line into your terminal it will install all the libraries in your system.

sudo apt-get install python-pychart python-pyparsing python-dateutil python-decorator python-docutils python-feedparser python-imaging python-jinja2 python-ldap python-lxml python-mako python-mock python-openid python-passlib python-psutil python-psycopg2 python-reportlab python-requests python-simplejson python-unittest2 python-vobject python-werkzeug python-yaml

Step 4 : Install postgresql and pgadmin.
Copy and paste this command in your terminal it will install postgres datbase and GUI for postgres.


    sudo apt-get install postgresql pgadmin3

Step 5: Once you done with your postgres installation you need to create role for postgres who is accessing the OS.

Follow these steps to create role for postgres . for eg. your system user name is odoo. than we need to create role inside postgresql for odoo user.
 Execute these command one by one in your terminal.

A) sudo su postgres
B) psql postgres
     #when you run this command you will be inside the postgres ternimal.
C) create role odoo with login password 'odoo';
   # This command will create role inside the postgres with password 'odoo';
D) alter role odoo with superuser;
   # This command will make current role as super user will have the admin access of postgres.

Step 6 : If you want to access your postgres from GUI than follow this step.
Here you will come to know to configure multiple postgres server with single Screen.

A) Open your pgadmin. if its not install in your system than install it by using following command.


  sudo apt-get install pgadmin3
Once pgadmin get installed in your system than configure it by following steps.

 Open your pgadmin.


B) Click on Add Server Menu Item from File Menu.
    It will open pop up wizard fill the information.

           i) you can give any name to your postgres server.
           ii) Ip address of system where postgres is running. in our case its localhost.
           iii) When you install postgres by default port number is set to 5432. but if you are working with multiple postgres server than it might be different like.. 5433,5434 etc
           iv) Maintenance DB will be postgres as we have used postgres template.
           v) user name and password will odoo in our case . you can provide this value based on role you have created.
           vi) Click on Ok button than it will be done. now you will be able to access all the database those you will create in this postgres server.
  
Step 5 : Download Compatible Eclipse Editor into your system.

There are number of eclipse flavors available to use. Here you will find one of them which is aptana studio which in built having python(pyDev) plug in.

          Click to Download
 Once You are ready with your eclipse than you can move to next step. If you already have eclipse in your system than make sure you have pyDev plug in configured in your system.
If pyDev is not Configure in your system than you can configure by following steps.
PyDev Configureation:

 A) Go to Help Menu and click on Install new Software Menu item, it will open new window there you can your pyDev Plug in path.

     i) Click on Add button it will open one more window with two input value.

    


 ii) Now you can provide the value into this input box.
      - Give any name to your plug in .
      - Provide the path of pyDev.
        This path you can use 
        http://pydev.org/updates



 ii ) Select PyDev plug in and press next it will download the plug in your eclipse.



 Once you complete with Eclipse configuration create directory structure in your system.
 Step 6 : Follow this Directory Structure in your system it will be easy to handle all the source code and custom module in your system. you will be having workspace folder on your /home directory when you will open your eclipse.
A) Create Two folders

1) OpenERP or Odoo (You will paste all the source code version inside this directory)

2) Projects ( These folders will have all the custom project's module.)

B) Once You create these folder now you have to create generate category project from your eclipse with the same name.
Note :  make sure you are on the same workspace from eclipse where you created these folders.

C) Here you will follow the steps to create related project from eclipse.

i) Create New project from File Menu and Select General category project.



ii) Now Create the project with same name as you have created the folders inside the Workspace. for e.g. we have odoo folder in side work space so we will create project with same name.



Than click on finish. whatever the source code you will paste in your odoo folder it will automatically updated  in eclipse project.
Like wise you can handle multiple version source code from same project.

For the Projects you will follow the same steps, so it will updated all projects information from your workspace to your eclipse editor.



Hope this blog will helps you. if you have any problem than you can comment.