Skip to main content

Posts

Ubuntu 14.04 : Add 1280 x 1024 screen resolution

Spent around 2 hours to set new resolution for Ubuntu 14.04 and when come to know the right way it took only 5 minutes. So, writing this post so that it can save someone else's time. Following are the steps to add 1280 x 1024 screen resolution in Ubuntu 14.04 1) Create /etc/X11/xorg.conf file with following content: Section "Monitor"     Identifier    "Monitor0"     Modeline "1280x1024_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync EndSection Section "Screen"     Identifier     "Screen0"     Device         "Card0"     Monitor        "Monitor0"     SubSection "Display"         Modes       "1280x1024_60.00"     EndSubSection EndSection Section "Device"     Identifier    "Card0"     Driver       ...

Odoo/OpenERP : Populate one2many list using on_change method

Following is the method to update/populate simple field value using on_change method: return {'value' : {'field_name' : <field_value>}} Most of the OpenERP developers will be aware of it. What we will do if we have to add one2many list using on_change method? For example : I want to display list of leaves allotted, leaves taken and leaves pending of an employee. So on_change employee_id I want to show related updated leave list. leave_ids is one2many field in my main table. what we have to do is as follow: leave_ids = []        for record in records:     if record:         leave_ids.append([0,0, {'holiday_status_id':record,'max_leaves':records[record]['max_leaves'],'leaves_taken':records[record]['leaves_taken'],'remaining_leaves':records[record]['remaining_leaves']}]) return {'value' : {'leave_ids' : leave_ids}} Hopefully it will help someone. If you need more detail ...

Odoo/OpenERP: Create multiple sequence codes from single file

You can create multiple sequence codes from single sequence file. For example, if you want to create different employee codes for 'Regular Employee' and 'Trainee Employee' you can use single sequence file and achieve your results. As follow: If you don't know at all about sequences, how to create sequence in Odoo/OpenERP, Please click here . emp_code_sequence_view.xml <?xml version="1.0" encoding="utf-8"?> <openerp> <data>     <!-- Sequences for Regular Employee code -->     <record id="emp_code_sequence" model="ir.sequence.type">           <field name="name">Employee Code</field>         <field name="code">hr.employee</field>     </record>     <record id="seq_hr_employee" model="ir.sequence">         <field name="name">Employee Code</field>         ...

Odoo/OpenERP : Module files sequence in __openerp__.py

This post is regarding, how to add module files in sequence in __openerp__.py file. If you are not adding files in proper sequence you will face an error. For example: Wrong sequence: {     'name': 'Employee Data Module',     'version': '1.0',     'category': 'Human Resources',     'description':"""Add details of employee""",     'author':'Shiv Shankar',     'website': ' http://dirtyhandsphp.blogspot.in ',     'images': [],     'depends':['base','mail', 'hr',],     'data':[         'view/employee_data_view.xml',         'workflow/employee_data_workflow_view.xml',         'security/user_groups.xml',         'security/ir_rule.xml',         'security/ir.model.access.csv'     ],     'installable':True,     'auto_install':False } In above data f...

Oddo/OpenERP: Overwrite ACL permissions

To overwrite ACL permission in Odoo, you have to overwrite id of that ACL record. For example by default in Employee Appraisals module Human Resource/ Officer user group is given full permissions as follow. id - access_survey_page_hr_user name - survey.page.hr.user model_id:id - survey.model_survey_page group_id:id - base.group_hr_user perm_read - 1 perm_write - 1 perm_create - 1 perm_unlink - 1 and later in your customized module you decide to revoke unlink permission for that user group you have to just keep exact id and change permissions section. ACL record will be as follow: id - access_survey_page_hr_user name - survey.page.hr.user model_id:id - survey.model_survey_page group_id:id - base.group_hr_user perm_read - 1 perm_write - 1 perm_create - 1 perm_unlink - 0 Hopefully it will help someone. Thanks!!!!!!!!!!!!! Enjoy Programming :) Reference Link: https://bugs.launchpad.net/openobject-server/+bug/944561

Odoo/OpenERP : Call function on button

There are three ways to add functionality on button in OpenERP/Odoo: 1. Call function directly on button: You can directly call the function defined in model/class using type="object" attribute. i.e <button string="Check availability" name="check_username_availability" type="object" class="oe_highlight" /> In this case you have to define ' check_username_availablilty' function in model. 2. Using Workflow: Workflow is the most used functionality in OpenERP/Odoo to process flow of the activity. Default type of button is workflow i.e type="workflow" .  Workflow itself is an vital topic so can't talk much about this here. <button string="Accept" name="signal_accept" type="workflow" class="oe_highlight" /> 3. Using action: You have to user type="action" if you want to call any action defined in the .xml file. For example if you want to open...

Odoo/OpenERP: one2one relational field example

one2one relational field is deprecated in OpenERP version>5 but you can achieve the same using many2one relational field. You can achieve it in following two ways : 1) using many2one field in both the objects ( http://tutorialopenerp.wordpress.com/2014/04/23/one2one/ ) 2)  using inheritance by deligation You can easily find the first solution with little search over internet so let's start with 2nd solution. Scenario :  I want to create a one2one relation between two objects of openerp hr.employee and hr.employee.medical.details What I should do  i. Add _inherits section in hr_employee class ii. Add field medical_detail_id in hr_employee class class hr_employee(osv.osv):     _name = 'hr.employee'     _inherits = {' hr.employee.medical.details ': "medical_detail_id"}     _inherit = 'hr.employee'         _columns = {             ...