Skip to main content

Posts

Showing posts from July, 2014

Odoo/ 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 o r 127.0.0.1:8069 c) Login into OpenERP; Go t

Odoo/ 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

Odoo/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, 'Na me already exists ', ['name'])]  Thanks!!!!!!!!!! Enjoy Programming :) Reference Link :  http://stackoverflow.com/questions/13263507/openerp-unique-constraint

Odoo/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 :) Referen