Friday, 18 July 2014

OpenERP Common Errors

From last one month started working on OpenERP. While customizing code daily facing one or the other issue. So thought of keeping all of them at one place with solutions for future use and may be can help someone else as well :

1) AttributeError: 'NoneType' object has no attribute '_columns'

Solution : Problem is with your __openerp__.py file. Check depends attribute.

Reference Links :
http://stackoverflow.com/questions/10565288/attributeerror-nonetype-object-has-no-attribute-columns
http://forum.openerp.com/forum/topic24199.html

2) Openerp : new module is not showing into module list?

Solution : If you have developed a new module and it's in the addons folder but still not showing in the module list than follow following steps :

a) Restart OpenERP server by using command :

./openerp-server --addons-path=XXXX/XXXXXXX/addons/ (path of addons directory)

b) Go to the browser and open

localhost:8069 or 127.0.0.1:8069

c) Login into OpenERP; Go to Settings menu; Users; Select your user, edit it and check the check-box of 'Technical Features', save it and reload the web page.

d) Again Go to Settings, you will find two more options under Modules section

  • Update Modules List
  • Apply Scheduled Upgrades

Click on 'Update Modules list' option. Update modules.

e) Now search your module using 'Installed Modules' option.

That's it.

Reference Links :


Many more to come.....

Saturday, 5 July 2014

OpenERP: Customize one2many relational field

I was working on one2many relational field to integration one functionality. Worked on python code and then wrote an xml file for the same. Restarted my server. It showed me the row with headers and 'Add an item' button. When clicked on that it opened a pop-up to provide inputs. It shows all the fields with in sequence of it's own.


Q1. I need input fields in other sequence or don't need all fields.

A.   In xml you would have wrote code like this :

<field name="dirtyhandsphp" widget="one2many_list" colspan="4" nolabel="1">
<tree string="Details">
             <field name="field1" />
             <field name="field2" />
                     ---------------------------------------------
             <field name="designation" />
        </tree>                                                    
</field>

Add form section inside and mention all the fields you needed, as follow :

<field name="dirtyhandsphp" widget="one2many_list" colspan="4" nolabel="1">
<tree string="Details">
             <field name="field1" />
             <field name="field2" />
                     ---------------------------------------------
             <field name="designation" />
        </tree>
        <form string="Details" editable="bottom">
             <field name="field1" />
             <field name="field2" />
                     ---------------------------------------------
             <field name="designation" />
        </form>                                            
</field>

Q2. Fields are few so want to edit at the same place. No separate pop-up.

A. Add editable attribute to tree tag as follow

<tree string="Details" editable="bottom">

or

<tree string="Details" editable="top">


Thanks!!!!!!!! Enjoy Programming:)


Friday, 4 July 2014

OpenERP: Custom unique name constraint with ignore case

#custom unique name constraint with ignore case

def _check_unique_insesitive(self, cr, uid, ids, context=None):

        list_ids = self.search(cr, uid , [], context=context)

        lst = [list_id.name.lower() for list_id in self.browse(cr, uid, list_ids, context=context) if list_id.name and list_id.id not in ids]

        for self_obj in self.browse(cr, uid, ids, context=context):
            if self_obj.name and self_obj.name.lower() in lst:
                return False
            return True


Use as following in your class :

_constraints = [(_check_unique_insesitive, <error_message>, ['<field_name>'])] 

e.g : _constraints = [(_check_unique_insesitive, 'Name already exists', ['name'])] 


Thanks!!!!!!!!!! Enjoy Programming :)


Reference Link : http://stackoverflow.com/questions/13263507/openerp-unique-constraint

Wednesday, 2 July 2014

OpenERP Warning : invalid module names, ignored

Create a new module and new class. After adding 2 variables in class, I tried to restart OpenERP server with following command :

Command : $./openerp-server -u <module_name> -d <db_name>

Example : $./openerp-server -u my_training -d training

Server got started but showed me following warning message on console :

Warning :  invalid module names, ignored

Checked code and followed all necessary steps to check each and everything but was not getting any clue. After some time found a link and ran following command on console :

Command : $./openerp-server -u base -i <module_name> -d <db_name>

Example : $./openerp-server -u base -i my_training -d training

It worked. What this command will do is; it will install all the base modules and update your new module as well.

I feel like this solution is good but not the best. If someone else is having better one please don't hesitate to post as comments.

Thanks!!!!!! Enjoy Programming :)

Reference Link : https://www.odoo.com/forum/Help-1/question/is-Update-Module-List-from-command-line-possible-54578

Thursday, 19 June 2014

Creately for Diagramming

In IT world, day-to-day activities, we have to work with projects and provide some wireframes, flowcharts and other graphical diagrams to internal (seniors) and external clients. There are a lot of tools available to create all these diagrams.

Few days back, from one of my senior I come to know about Creately, an online fast tool to create wireframes, flowcharts, graphical diagrams etc. You can draw almost everything using Creately. It’s really user friendly. You will create your diagram; do changes; save it there. You can export it in form of Image, PDF or SVG file.

You can start using it with Google account from here: https://creately.com/openid/google/login

Or directly from their website: https://creately.com

I love it the way it works.

You can use Free or Paid account. In case you are using free account you have to share your diagrams publicly. That’s the only and the biggest disadvantage they are having.


Thanks!!!!!!!! Enjoy Programming J