Here shows my model class which i need to add approval work flow.
class bpl_work_update(osv.osv):
_name = "bpl.work.update"
_description = "BPL Work Update"
_columns = {
'bpl_company_id':fields.many2one('res.company', 'Company', help='Company'),
'ref_no': fields.char('Reference No', size=10,),
'offered_date': fields.date('Offered Date'),
# below lines are related to work update approve Workflow (i refer hr.holidays model for )
'state': fields.selection([('draft', 'To Submit'), ('cancel', 'Cancelled'), ('confirm', 'To Approve'), ('refuse', 'Refused'), ('validate1', 'Second Approval'), ('validate', 'Approved')],
'Status', readonly=True, track_visibility='onchange'),
'user_id': fields.many2one('hr.employee', 'Add records', invisible=False, readonly=True),
'manager_id': fields.many2one('hr.employee', 'First Approval', invisible=False, readonly=True),
}
_defaults = {
'bpl_company_id':_default_company,
'offered_date':fields.date.context_today,
'state': 'draft',
'user_id': lambda obj, cr, uid, context: uid,
}
bpl_work_update()
Here shows my view.xml file (i got only lines here which are related to work flow handling )
<header>
<button string="Approve" name="validate" states="confirm"
type="workflow" groups="group_checkroll_user" class="oe_highlight" />
<button string="Validate" name="second_validate" states="validate1"
type="workflow" groups="group_checkroll_manager" class="oe_highlight" />
<button string="Refuse" name="refuse" states="confirm,validate,validate1"
type="workflow" groups="group_checkroll_manager" />
<button string="Reset to New" name="set_to_draft" states="cancel,refuse"
type="object" groups="group_checkroll_manager" />
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate"
statusbar_colors='{"confirm":"blue","validate1":"blue","refuse":"red"}' />
</header>
i have no idea for how to implement this approval type work flow. i refer hr.holidays model class but unable to got clear idea about it. please help me to add level to approve my work order request. & please give me a link to refer regarding this type of work flow creating..
now that workflow buttons added to form and shows correctly.but how to handle those.? here is my screen