Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

Workflow doesn't work

By
Amine
on 3/21/15, 9:39 AM 675 views

Hello

I follow the tutorial of documentation Odoo, Openacademy,

at the level of workflow, i set the signal attribute of transition egal a name of button,

with the type button egal a workflow

but the workflow doesn't work

help me please

1
Alby Antony
On 4/10/15, 7:10 AM

create a field in the database


'state': fields.selection([

('draft', 'Draft'),

('verify', 'Verified'),

('cancel', 'Cancelled'),

('done', 'Approved')],

'Status',  readonly=True,),

copy the code in view file

<header>

<button string="Verify" name="action_verify" states="draft,cancel" type="object" class="oe_highlight" />

<button string="Cancel" name="action_cancel" states="draft,verify" type="object" class="oe_highlight" />

<button string="Approve" name="action_approve" states="verify" type="object" class="oe_highlight" />

<field name="state" widget="statusbar" statusbar_visible="draft,verify,done,cancel" class="oe_highlight" type="workflow"/>

</header>


write the functions in .py file


def action_verify(self,cr, uid, ids, context=None):

      if context is None:

          context = {}

      self.write(cr, uid, ids, {'state': 'verify'}, context=context)

      return True


def action_cancel(self,cr, uid, ids, context=None):

      if context is None:

          context = {}

      self.write(cr, uid, ids, {'state': 'cancel'}, context=context)

      return True


def action_approve(self,cr, uid, ids, context=None):

      if context is None:

          context = {}

      self.write(cr, uid, ids, {'state': 'done'}, context=context)

      return True

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/21/15, 9:39 AM
Seen: 675 times
Last updated: 4/13/15, 6:26 AM