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.

0

How can i resolve the buttons problem?

By
PAV ALEXI
on 5/21/13, 7:11 AM 698 views

Hello!

I have a problem with the 'won' and 'lost' buttons. In assigned mode, 'won' and 'lost' buttons don't work, but in the negotiation mode the buttons work good.

If you know what is the problem with the buttons in the assigned mode, please help me!

Thanks!

example_Module.py

_name = 'student.student'

_columns = {
        'name' : fields.char('Student Name', size=16, required = True, translate=True),
        'year' : fields.integer('Year of study'),
        'average' : fields.float('Grade Average',help = 'This field will add grade average.'),
        'gender' : fields.selection([('male','Male'),('female','Female')],'Gender'),
        'mathematics' : fields.boolean('Mathematics'),
        'notes' : fields.text('Details'),

'state': fields.selection([
('new','New'),
('assigned','Assigned'),
('negotiation','Negotiation'),
('won','Won'),
('lost','Lost'),
('aaa','Aaa'),
('bbb','Bbb')], 'Stage', readonly=True),
}

def mymod_new(self, cr, uid, ids):
 self.write(cr, uid, ids, { 'state' : 'new' })
 return True

def mymod_assigned(self, cr, uid, ids):
 self.write(cr, uid, ids, { 'state' : 'assigned' })
 return True

def mymod_negotiation(self, cr, uid, ids):
 self.write(cr, uid, ids, { 'state' : 'negotiation' })
 return True

def mymod_aaa(self, cr, uid, ids):
 self.write(cr, uid, ids, { 'state' : 'aaa' })
 return True

def mymod_won(self, cr, uid, ids):
 self.write(cr, uid, ids, { 'state' : 'won' })
 return True

def mymod_lost(self, cr, uid, ids):
 self.write(cr, uid, ids, { 'state' : 'lost' })
 return True

def mymod_bbb(self, cr, uid, ids):
 self.write(cr, uid, ids, { 'state' : 'bbb' })
 return True

_defaults = { 
            'name' : 'Student X',
            'mathematics' : False, 


}

File example_Module_view

<?xml version="1.0" encoding="utf-8"?>
  <openerp>
    <data>

<!--Student Form View-->

    <record id="student_student_form" model="ir.ui.view">
    <field name="name">student.result.form.new</field>
    <field name="model">student.student</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
      <form string="Student_result" version="7.0" >
        <sheet>
          <group colspan="2" col="2">
            <h3><label for="name"/></h3>
            <h4>
              <field name="name" placeholder="Insert the student's name"/>
            </h4>
            <h3>
                <label for="year" />
            </h3>
            <h4> 
              <field name="year" placeholder="Insert the year of study"/>
            </h4>
            <h3>    
              <label for="average"/>
            </h3>   
            <h4>    
              <field name="average" placeholder="Insert the grade average"/>
            </h4>   
            <h3> 
              <label for="gender"/>
            </h3>   
            <h4>    
              <field name="gender" placeholder="Choose the gender" />
            </h4>   
            <h3>    
              <label for="mathematics"/>
            </h3>   
            <h4><field name="mathematics" /></h4>   
            <h3><label for="notes"/></h3>
            <h4><field name="notes" placeholder="Insert a note" /></h4>
          </group>
          <button string="Send New Email" name="%(mail.action_email_compose_message_wizard)d" icon="terp-mail-message-new" type="action"/>
        </sheet>
        <field name="state" invisible="False" />
        <separator string="Workflow Actions" colspan="4"/>
        <group colspan="4" col="3">
          <button name="mymod_assigned" string="Assigned" states="new" />
          <button name="mymod_negotiation" string="In Negotiation" states="assigned" />
          <button name="mymod_aaa" string="Aaa" states="assigned" />
          <button name="mymod_won" string="Won" states="assigned" />
          <button name="mymod_lost" string="Lost" states="assigned" />
          <button name="mymod_won" string="Won" states="negotiation" />
          <button name="mymod_lost" string="Lost" states="negotiation" />
          <button name="mymod_bbb" string="Bbb" states="negotiation" />
        </group>
      </form>
    </field>
    </record>

<!-- Student search view -->
<record model="ir.ui.view" id="student_search">
  <field name="name">student.search</field>
  <field name="model">student.student</field>
  <field name="type">search</field>
  <field name="arch" type="xml">
    <search string="Student Information Search" version="7.0">
      <field name="name" string="Student Name search1" />
      <field name="gender" string="Gender" />
      <field name="year" string="Year of study" />
      <field name="average" string="Grade Average" />
    </search>
  </field>
</record>

<!-- Student tree view -->
<record id="student_student_tree" model="ir.ui.view">
  <field name="name">student.result.tree.new</field>
  <field name="model">student.student</field>
  <field name="type">tree</field>
  <field name="arch" type="xml">
    <tree string="Student_result" editable="top" toolbar="1">
      <field name="name" />
      <field name="year" />
      <field name="average" />
      <field name="gender" />
      <field name="mathematics" />
    </tree>
  </field>
  <field name="help" type="html">
    <p class="oe_view_nocontent_create"> Click to define a new record. </p>
    <p> Provide your information here. </p>
  </field>
</record>

<!--Student Graph View-->
<record model="ir.ui.view" id="student_student_graph">
  <field name="name">student.result.graph</field>
  <field name="model">student.student</field>
  <field name="type">graph</field>
  <field name="arch" type="xml">
    <graph string="Student_result" version="7.0">
      <field name="name"/>
      <field name="year"/>
      <field name="average" />
      <field name="gender" />
      <field name="mathematics" />
      <field name="notes" />
    </graph>
  </field>
</record>

<!-- Student Action-->
<record id="action_student_student" model="ir.actions.act_window">
  <field name="name">Students and Courses</field>
  <field name="res_model">student.student</field>
  <field name="view_type">form</field>
  <field name="view_mode">tree,graph,form</field>
</record>

<!--Student Menu-->
<menuitem id="student_parent" name="Alexis Module" icon="terp-partner"/>
<menuitem id="menu_student_parent" name="Student Info" parent="student_parent">
</menuitem>
<menuitem action="action_student_student" id="menu_student_student" parent="menu_student_parent" string="Result"/>

</data>
</openerp>

File mymod_workflow <openerp> <data>

<record model="workflow" id="wkf_mymod">
  <field name="name">mymod.wkf</field>
  <field name="osv">student.student</field>
  <field name="on_create">True</field>
</record>

<record model="workflow.activity" id="act_new">
  <field name="wkf_id" ref="wkf_mymod" />
  <field name="flow_start">True</field>
  <field name="name">new</field>
  <field name="kind">function</field>
  <field name="action">mymod_new()</field>
</record>

<record model="workflow.activity" id="act_assigned">
  <field name="wkf_id" ref="wkf_mymod" />
  <field name="name">assigned</field>
  <field name="kind">function</field>
  <field name="action">mymod_assigned()</field>
</record>

<record model="workflow.activity" id="act_negotiation">
  <field name="wkf_id" ref="wkf_mymod" />
  <field name="name">negotiation</field>
  <field name="kind">function</field>
  <field name="action">mymod_negotiation()</field>
</record>

<record model="workflow.activity" id="act_aaa">
  <field name="wkf_id" ref="wkf_mymod" />
  <field name="name">aaa</field>
  <field name="kind">function</field>
  <field name="action">mymod_aaa()</field>
  <field name="flow_stop">True</field>
</record>

<record model="workflow.activity" id="act_won">
  <field name="wkf_id" ref="wkf_mymod" />
  <field name="name">won</field>
  <field name="kind">function</field>
  <field name="action">mymod_won()</field>
  <field name="flow_stop">True</field>
</record>

<record model="workflow.activity" id="act_lost">
  <field name="wkf_id" ref="wkf_mymod" />
  <field name="name">lost</field>
  <field name="kind">function</field>
  <field name="action">mymod_lost()</field>
  <field name="flow_stop">True</field>
</record>

<record model="workflow.activity" id="act_bbb">
  <field name="wkf_id" ref="wkf_mymod" />
  <field name="name">bbb</field>
  <field name="kind">function</field>
  <field name="action">mymod_bbb()</field>
 <field name="flow_stop">True</field>
</ record>

<record model="workflow.transition" id="t1">
  <field name="act_from" ref="act_new" />
  <field name="act_to" ref="act_assigned" />
  <field name="signal">mymod_assigned</field>
</record>

<record model="workflow.transition" id="t2">
  <field name="act_from" ref="act_assigned" />
  <field name="act_to" ref="act_negotiation" />
  <field name="signal">mymod_negotiation</field>
</record>

<record model="workflow.transition" id="t3">
  <field name="act_from" ref="act_assigned" />
  <field name="act_to" ref="act_aaa" />
  <field name="signal">mymod_aaa</field>
</record>

<record model="workflow.transition" id="t4">
  <field name="act_from" ref="act_negotiation" />
  <field name="act_to" ref="act_won" />
  <field name="signal">mymod_won</field>
</record>

<record model="workflow.transition" id="t5">
  <field name="act_from" ref="act_negotiation" />
  <field name="act_to" ref="act_lost" />
  <field name="signal">mymod_lost</field>
</record>

<record model="workflow.transition" id="t6">
  <field name="act_from" ref="act_negotiation" />
  <field name="act_to" ref="act_bbb" />
  <field name="signal">mymod_bbb</field>
</record>

<record model="workflow.transition" id="t7">
  <field name="act_from" ref="act_assigned" />
  <field name="act_to" ref="act_won" />
  <field name="signal">mymod_w</field>
</record>

<record model="workflow.transition" id="t8">
  <field name="act_from" ref="act_assigned" />
  <field name="act_to" ref="act_lost" />
  <field name="signal">mymod_x</field>
</record>

  </data>
</openerp>

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

0 follower(s)

Stats

Asked: 5/21/13, 7:11 AM
Seen: 698 times
Last updated: 3/16/15, 8:10 AM