Skip to main content

Posts

Odoo/ OpenERP: Calculate difference between two dates

from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta date_format = '%Y-%m-%d' joining_date = '2013-08-23' current_date = (datetime.today()).strftime(date_format) d1 = datetime.strptime(joining_date, date_format).date() d2 = datetime.strptime(current_date, date_format).date() r = relativedelta(d2,d1) print r.years print r.months print r.days Thanks!!!!!!!!! Enjoy Programming :)

File upload not working on PHP Server

Few days back, our team faced a new issue in file upload on server. It was restricting user to upload file size over 8KB while the following parameters were already set : php_value file_uploads  On php_value upload_max_filesize 200M php_value memory_limit  512M php_value post_max_size 200M php_value max_execution_time 1000 php_value max_input_time 300 but still file uploading was not working. Searched over internet and found that above problem was due to LimitRequestBody Directive of Apache. This parameter Restricts the total size of the HTTP request body sent from the client. "The LimitRequestBody directive allows the user to set a limit on the allowed size of an HTTP request message body within the context in which the directive is given (server, per-directory, per-file or per-location). If the client request exceeds that limit, the server will return an error response instead of servicing the request. The size of a normal request message body will vary greatl...

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>   ...

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...

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 Prog...

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