Your SlideShare is downloading. ×
0
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Workflow functional concept on openerp7
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Workflow functional concept on openerp7

2,203

Published on

Published in: Software, Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,203
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
128
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Note:
    The first two arguments wkf_id and name are mandatory per each activity.
  • transition rules
    Workflow transition rules are rules that restrict some operations to certain groups. Those rules handle rights to go from one step to another one in the workflow. For example, you can limit the right to validate an invoice, i.e. going from a draft action to a validated action.
  • // how to defines groups and security next session ISA
  • Previously I add hol_job_id filled to hr. holidays refer to job id for employee
  • Transcript

    • 1. Workflow Functional Concept OPENERP7
    • 2. Contents  What is workflow  Workflow Goals  Benefits of applying Workflow  Defining Workflow  Example holiday Request approval  How to modify the workflow  How to add approval workflow OpenERP 7  How to hide a workflow button based on user in OpenERP7
    • 3. The workflow system in OpenERP  is a very powerful mechanism that can describe the evolution of documents (model) in time.
    • 4. Goals of Workflow Mechanism  description of document evolution in time  automatic trigger of actions if some conditions are met  management of company roles and validation steps  management of interactions between the different objects/modules  graphical tool for visualization of document flows
    • 5. Advantage of Workflow in OpenERP7  Workflows are entirely customizable, they can be adapted to the flows and trade logic of almost any company. The workflow system makes OpenERP very flexible and allows it to easily support changing needs without having to program new functionality.
    • 6. Defining Workflow  Define the States of your object  The first step is to define the States your object can be in. We do this by adding a 'state' field to our object, in the _columns collection Example Hr.Holidays Model: 'state': fields.selection([('draft', 'To Submit'), ('cancel', 'Cancelled'),('confirm', 'To Approve'), ('refuse', 'Refused'), ('validate1', 'dept_mang_apprv'), ('validate2', 'head_mang_apprv'), ('validate', 'Approvedff')], 'Status', readonly=True, track_visibility='onchange',  Define the State-change Handling Methods  Add additional methods to your object. These will be called by our workflow buttons.
    • 7. Defining Workflow  Creating your Workflow XML file File Path : serveraddonsmodule folder[module_name]_workflow.xml Workflow Header Record Activity Record Do action Activity Record Do action Transition Record: condition must executed to transfer These define the actions that must be executed when the workflow reaches a particular state. These define the possible transitions between workflow states
    • 8. Activity: These define the actions that must be executed when the workflow reaches a particular state.  “ Draft Activity “ <record model="workflow.activity" id="act_draft"> <!-- draft --> <field name="wkf_id" ref="wkf_holidays" /> <field name="flow_start">True</field> <field name="name">draft</field> </record>
    • 9. Activity Fields  flow_start Indicates if the node is a start node. When a new instance of a workflow is created, a workitem is activated for each activity marked as a flow_start.  flow_stop Indicates if the node is an ending node. When all the active workitems for a given instance come in the node marked by flow_stop, the workflow is finished.
    • 10.  kind Possible values: dummy: Do nothing (default). function: Execute the function selected by an action field. subflow: Execute a sub-workflow SUBFLOW_ID. The action method must return the ID of the concerned resource by the subflow. If the action returns False, the workitem disappears.  action The action indicates the method to execute when a workitem comes into this activity. The method must be defined in an object which belongs to this workflow
    • 11. Transition: are the conditions which need to be satisfied to move from one activity to the next.  The conditions are signals: button pressed in the interface[view.xml file for module ] # create button of type workflow signals are evaluated before the expression. If a signal is false, the expression will not be evaluated.
    • 12. Transition Fields act_from Source activity. When this activity is over, the condition is tested to determine if we can start the ACT_TO activity. act_to The destination activity. condition Expression to be satisfied if we want the transition done. signal When the operation of transition comes from a button pressed in the client form, signal tests the name of the pressed button. If signal is NULL, no button is necessary to validate this transition. Group id user to do this action must have privildge rules on this group , if not will displayed permission denied
    • 13. Holidays Request Approval mechanism  Manage employee leaves from the top menu "Human Resources". Employees can create leave requests that are validated by their manager and/or HR officers. note and/or based on chosen holiday type on holiday request  Once validated, they are visible in the employee's calendar.  HR officers can define leave types and allocate leaves to employees and employee categories
    • 14. Customized Holidays Request Approval mechanism  Based on job employement hierarchy :  How to add approval workflow OpenERP 7  How to control number of approvals based on employee job id department manager project manager project manager project manager developer1 developer2 Head Manager
    • 15. Fit your Needs draft state='to submit' (draft) confirm holidays_confirm() state=‘confirm' (to approve) validate holidays_validate() state='approvedff' (validate)) Validate_second holidays_second_validate() state='head_man_apprv' (validate2) First_validate holidays_first_validate() state='dept_man_apprv' (validate1) Approve ValidateValidate2 Refuse Holidays_refuse() State=‘refuse’ EmpJobid=developer Split mode = or Join mode = Xor [default]
    • 16.  “ Draft Activity “ <record model="workflow.activity" id="act_draft"> <!-- draft --> <field name="wkf_id" ref="wkf_holidays" /> <field name="flow_start">True</field> <field name="name">draft</field> </record>
    • 17.  “ Frist Validate activity ” <record model="workflow.activity" id="act_validate1"> <!-- first_accepted --> <field name="wkf_id" ref="wkf_holidays" /> <field name="name">first_validate</field> <field name="kind">function</field> <field name="action">holidays_first_validate()</field> <field name="split_mode">OR</field> </record>
    • 18.  “Validate Activity ” <record model="workflow.activity" id="act_validate"> <!-- accepted --> <field name="wkf_id" ref="wkf_holidays" /> <field name="name">validate</field> <field name="kind">function</field> <field name="action">holidays_validate()</field> </record>
    • 19. Steps to modify hr.wkf.holidays  Follow needs flow diagrams :  To add another approval state : Modify state field in _column partion in class hr.holidays in hr_holidays.py to be: 'state': fields.selection([('draft', 'To Submit'), ('cancel', 'Cancelled'),('confirm', 'To Approve'), ('refuse', 'Refused'), ('validate1', 'to dept_mang_apprv'), ('validate2', 'to head_mang_apprv'), ('validate', 'Approvedff')],'Status', readonly=True, track_visibility='onchange',
    • 20.  Add activity node In xml file for this state <record model="workflow.activity" id="act_validate2"> <!-- second_accepted --> <field name="wkf_id" ref="wkf_holidays" /> <field name="name">validate_second</field> <field name="kind">function</field> <field name="action">holidays_second_validate()</field> <field name="split_mode">OR</field> </record>
    • 21.  Previuosly, define function holidays_second_validate() in hr_holidays.py file def holidays_second_validate(self, cr, uid, ids, context=None): self.check_holidays(cr, uid, ids, context=context) obj_emp = self.pool.get('hr.employee') ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)]) manager = ids2 and ids2[0] or False self.holidays_first_validate_notificate(cr, uid, ids, context=context) return self.write(cr, uid, ids, {'state':'validate2', 'manager_id': manager})
    • 22.  this node will be active based on transition defined: <record model="workflow.transition" id="holiday_validate1_validate2"> <!-- 4. first_accepted -> second accepted (second_validate signal) --> <field name="act_from" ref="act_validate1" /> <field name="act_to" ref="act_validate2" /> <field name="signal">second_validate</field> <field name="condition">True</field> <field name="group_id" ref="base.group_hr_user"/> </record>
    • 23. OR this node will be active based on transition defined: <record model="workflow.transition" id="holiday_confirm2validate2"> <!-- 2. submitted->dept_man_approval directlyif jobid==1[project manager]) --> <field name="act_from" ref="act_confirm" /> <field name="act_to" ref="act_validate2" /> <field name="signal">validate</field> <field name="condition">True</field> <!--field name="condition">check_job_promag()</field--> <field name="group_id" ref="base.group_hr_user"/> </record>
    • 24.  check_job_promag() is defined in object class in hr_holidays.py file and check must return false or true to satisfy expression def check_job_promag(self, cr, uid, ids, context=None): #hol_ids=self.search(cr, uid,[('hol_job_id','=',1)]) for record in self.browse(cr, uid, hol_ids, context): if record.hol_job_id==1: return True else: return False
    • 25.  Buttons of type workflow is defined in hr_holidays_view.xml <button string="Validate" name="second_validate" states="validate1" type="workflow" class="oe_highlight"/>  To apply this workflow file on state change of module , must be called in descriptor of module __openerp__.py file
    • 26. Useful URLS regarding workflow  https://doc.openerp.com/v6.1/developer/07_workflows.html/  exception handling during workflow transitions: https://answers.launchpad.net/openobject-server/+question/103295  How to hide a workflow button based on user in openerp 7? http://stackoverflow.com/questions/23568345/how-to-hide-a-workflow-button-based-on-user-in- openerp-7  How to add approval workflow OpenERP 7 http://stackoverflow.com/questions/16393415/how-to-add-approval-workflow-openerp-7?rq=1

    ×