Skip to main content

Posts

Showing posts from November, 2014

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>         <field name=&

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