Wednesday, December 11, 2013

Motorola Charm ( MB502 ): Rooting and upgrading to Android Gingerbread (2.3.7)

    After a long time I'm writing a new post. Its regarding Android. I have a Motorola Charm which is a Android(2.1 Eclair) phone. As Motorola has not giving any upgrade for this phone and the phone having less internal memory and has no option to save the application to SD card makes the phone a bad one. So I was looking for a way to upgrade android version to 2.3. Last year I found the way to upgrade my phone, but I was afraid of taking risk as there is a change of getting it brick. So I didn't tried. As time passes a part of my phone's touch screen is dead. Now the Home, settings and back buttons are not working. So I searched everywhere for an App which give a virtual buttons to home,settings and back button. I found  an app called Virtual Button for root. So I dont have any other option but root the phone.

Flashing

Flashing is the fist process for rooting. As the default software in our phone is locked(with Blur) and rooting on this will make the phone brick. So first we have to flash it with deblur stack ROM sbf file. So we need to first download the sbf file.
click here to choose and download the SBF files. Select accordingly to your provider and build number. If you are using MB502 of indian/Asian version, then click here to download the sbf file. You can find it in the above link also.

Flashing In windows
For flashing in windows, you need the RSD Lite(click to download). Download it and install it. Get into bootloader mode by holding the up-arrow-key on the keyboard while powering on the phone. A black screen with white letters should show after a couple of seconds. Connect with USB. Specify the downloaded sbf file and click on  start button in the RSD Lite window. Don't disconnect USB until the result in RSD Lite shows Finished.
Flashing In Linux
Get into bootloader mode by holding the up-arrow-key on the keyboard while powering on the phone.
* open Terminal
* wget http://dl.opticaldelusion.org/sbf_flash
* chmod +x sbf_flash
* sbf_flash T-mo.sbf
* reboot your phone

Rooting

After flashing rooting can be done using SuperOneClick software in windows.As I haven't tried in linux and this is the best way I found, I prefer to use SuperOneClickSuperOneClick download link. Download it run it which will download another compressed file. Extract it and run the exe file.
  • Install the Motorola drivers
  • in the phone go to Settings > Applications > Development
  • select USB Debugging
  • connect USB cable
  • set USB mode to "Portal & Tools" or "PC mode"
  • run SuperOneClick
  • click Root
  • Done!
Now your Phone is rooted. It time to upgrade it to  higher versions of android. 2.3.7 is the one I got.

Upgrading

After rooting we can go for upgrading. Rooting is an important process for upgrading.
  • First download and install FlipOut Recovery in your phone.
  • Download the ROM and Google Apps and motorola charm patch. 
  • Put in the root of sdcard.
  • Open the application FlipOutRecovery give root permissions, then click the "Install Recovery" button. After installing click the "Reboot Recovery" button. The system will reboot with ClockworkMod menu.
  •  First Wipe data then  wipe cache then go to advanced  and wipe Dalvik cache. Use Vol + and Vol - to move up and down and click 'ok' in the phone keyboard to select.
  • After wiping, Select "install zip from sdcard" then "choose zip from sdcard" then Select the ROM(ROM you want to use) and go to - yes - and wait until you finish installation, 
  • Now select "install zip from sdcard" - "choose zip from sdcard" - select Google Apps and go up - yes - and wait until finish installation.
  • Now select "install zip from sdcard" - "choose zip from sdcard" - select charm patch and go up - yes - and wait until finish installation.
  • Then go back and again wipe data, cache and advanced / Dalvik cache.
  • Reboot
 Now enjoy CM7. Check the version. Install the Apps you want!!

References:


  1. http://forum.xda-developers.com/wiki/Motorola_Charm
  2. http://forum.xda-developers.com/showthread.php?t=887416
  3. https://otimizandosmartphone.wordpress.com/
  4. http://forum.xda-developers.com/showthread.php?t=2238740
  5. http://iboos.lofter.com/post/967c4_74285a

Friday, July 19, 2013

Function tag in openERP v7 for calling a function when installing/updating the module

I dont think everyone is aware on the function tag in openERP. Last week I had a requirement that when my module is installed, then email alias should be created with the name of the database. I checked everywhere and cant find any useful things. I tried to modify javascript also.. Then I found this function tag.
 This tag is mainly used when you want to call a function/method after installing/updating the module.
Then write your method in your model. You can also pass arguments to the function. Following are some examples defined in openerp
Example 1:


Example 2:










Thursday, March 1, 2012

Filters in one2many field - OpenERP

Last week I got into a situation that I really need to use filtering in tree view of one2many field. I have seen the use of filtering in search view, but not in tree views.
Example:
First of all this is just an example.
I have created a sale order. Here same product comes 2 or 3 times.
Sale Order view- Before adding filter



Then I was thinking for a solution... then came to find out that we can pass the filter condition in one2many fields too.

<field name="order_line" mode="tree,form" colspan="4" nolabel="1" widget="one2many_list" context="{'group_by':'name'}"> 

Then I was able to get the filter view.

Sale Order view after adding filter.
 The point is that you just need to provide context="{'group_by':'field_name'}"Here field_name is the name of the field in the tree view.

Thursday, December 15, 2011

Using widgets in openerp 6.1

We have seen in OpenERP web/gtk client that some fields which are defined as many2one fields are shown as selection field or a float field which are shown in web/gtk client as a progress bar. I was confused when I first saw this. Then I came to know about widget given in XML file.
To apply widget for a field, go to the XML file, find the line where that field is specified then add widget='widget_name'
Example:
<field name="my_field" widget='widget_name'/>

In this blog I'm specifying different types of widgets that we can use in OpenERP.
  • selection :I have a many2one field to 'res.partner' and I don't want other users to get the data of 'res.partner' from that field. So I make the field as a selection by applying the widget so that only the name of the records will be shown.
    <field name="partner_id" widget='selection'/>
Progress Bar
  • progressbar : I have a float field and I want to show it as a progress bar. Then I use widget="progressbar". This field will be always a functional field which returns a float number. You can see this type of field in project.
    <field name="progress_rate" widget='progressbar'/>  

Status bar in Sale Order
  • statusbar : You may have seen in sale, purchase, invoice etc a selection field called "state". We can change the way this selection field appears. To change its view to statusbar,
    <field name="selection_field" widget="statusbar" statusbar_visible="state1,state4,state7" statusbar_colors='{"state2":"red","state3":"red","state5":"blue","state6":"blue"}'/> 

    Here state1 to state7 are the different states in the selection_field. In 'statusbar_visible' we specify the different states which should appear in the view. In 'statusbar_color' we specify the color for the status bar according to the states.
  • one2many : If there is a many2many field and we want to view it as a one2many field. Then we use 'one2many'.
  • many2many : If there is a one2many field and we want to view it as a many2many field, then we use 'many2many'
  • float_time : This is used for showing a float type field in 00:00 format
  • image : If we have a binary field for adding pictures/images, then by providing widget='image', we van view the image.
  • url : If we have a char field for adding website name, then by adding widget='url', the data in the field will have a hyperlink and by clicking on it, the website will be opened.
  • email: If we have a char field for adding the email address, and if we want to sent an e-mail to that address using our systems default mail client, use widget='email'

Tuesday, July 26, 2011

Group Operator in OpenERP for Grouping

When defining search views, we may sometimes need to add "group_by" filters for showing the list view in groups. For example,







 The image shown above is from sale order. Here the list view grouping is done by user_id(salesman). Let focus on Demo User. Here four sale orders are created by the Demo user.

This is the extended view. Here the name written in bold is the group name. Now focus on the Untaxed Amount and Total and the value writen inside the red marker. The value shown inside the red marker are actually the sum of float or integer fields comes under the group. Here comes the use of group operator. The default value for group_operator is sum. Thats why we are getting the sum when grouping. To change the default value goto our python file, in the field definition add group_operator="avg" to get the average, group_operator="min" to get the minimum value from the group, group_operator="max" to get the maximum value from the group.
For example,

 Here I added group_operator="avg" in the untaxed amount. Now we have to verify it by grouping.
 Here the value shown inside the red marker is the average of that group. Now you can try the min and max by changing the group_operator value.

Friday, July 1, 2011

Creating an Excel file or a spreadsheet using Python's xlwt (xlutils) module

A spreadsheet is used to simulates a paper accounting worksheet. It displays multiple cells usually in a two-dimensional matrix or grid consisting of rows and columns. We have so many reporting software s that will simply create spreadsheets. But the problem is, these reporting software s may not support on all systems and also take lot of CPU time. Then arise an idea to use some method to create spreadsheet from my python code. Then I found about the module xlutils in python.

XLUTILS module contain packages for reading from(xlrd) and writing to(xlwt) excel files. Since I only need the package to write to excel file I'm installing the xlwt package.

Installation
We can install any python package to our repository using pip, pip is an easy way to install python packages.
To install pip
omal@zbeanz:~$sudo apt-get install python-pip
After installing pip you can install python packages by
omal@zbeanz:~$sudo pip install xlwt
This will install xlwt package to python modules

 Now in our python code,
to import the package functionality to the our program.
We can define the title, header, number, date, and normal style using xlwt.easyxf(). For example title style is given below
We can define as many styles we want. We can also define how the border should appear. For example,
After defining the styles we can now define the workbook. Workbook is actually what we view in our spreadsheet. To define workbook,
A spreadsheet may contain more than one sheet, so to add sheets,
Now we can start adding data to the sheet we have created.  To write data to the 'sheet1' use the reference ws and ws.write(row, column, 'Value or text',style). For example:
To change the width and height of a cell,
 We can add complete data to the spreadsheet by writing and changing the height and width according to our need. After completing this we can save the workbook to a buffer. So First define the buffer and then save the workbook to the  buffer. This doesn't complete the process.
Now we have to encode the data in the buffer and write it to a file say 'test.xls'. To encode the data in the buffer import base64 module. Now open the file test.xls to view our excel file we have created.


I have not mentioned the last few steps (from encoding) so that you can try it out.

Tuesday, March 29, 2011

Creating a Jasper Report using osv_memory in OpenERP 6

I first started using Jasper Report for OpenERP 5. I used a wizard( created using wizard.interface) and the data provided in the wizard is passed to the Jasper Report module and that's it. A well aligned attractive report is created in pdf, xls, html or txt format respective to the report type I provide in the wizard. This works well in openerp-client as well as openerp-web. Then I get a chance to  create the Jasper Report in OpenERP v6. It was simple to change the same jasper report module  of openerp5 to openerp6 and it works fine in openerp-client. But when I opened openrp- web and tried to create the report some unknown characters are printed in the html page and only the html report is working correctly. I spent hours in this issue and then Jabir, one of the hardcore programmer of zbeanz told me that openerp6 had stopped providing support to wizard.interface and told me to use the osv_memory to create the wizard. So I started creating Jasper Report  using osv_memory.

When creating a wizard using osv.osv_memory we need to create a model and view for the wizard, the same process we use to create a  model and view using osv.osv. The main difference inusing osv.osv and osv.osv_memory is that it osv_memory doesnt create tables in the database and osv_memory creates a table in the memory only when the wizard model is active.

If we are creating a multi-stage(multi-state) wizard then each stage depends on the value 'state' defined in the field of the wizard model.




For the state field we have to provide a default value. When we click on the wizard the view depends on this default state. We also have to define some functions that return a value to the next state or returns a value to the report. In my wizard there is only one stage in which when I click on the create button a report(Jasper report ) is created. The function is given below.

Here 'report_name' is the name of the report. This is the place where our jasper report is called. I'm providing the name of the jasper report that is already created myself. At the report module we get the 'datas' from the data. And data['form'] will give all the values provided in the wizard model. Here id and ids are not necessary. 'nodestroy' is for not destroying the wizard when creating the report.

VIEW PART 

Define the record then define form. Inside the form define group for each state.
Inside this group define all the fields that should display in this stage. Then create buttons, one for cancelling the wizard and other for creating the report.

The object type button has the name create_report which is a function defined in the wizard model. After creating the report define the actions and also specify the jasper report file location. Create the menuitem where you want to display the wizard. 

Our wizard creation is now complete and now restart our server and update our module, the new wizard will start working.


note: If anybody have any doubts or need the module I have created fell free to contact me. mail me to omalbastin@gmail.com