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

press button but not transfer between workflow ? please help me

By
nguyen vu
on 7/14/13, 2:22 PM 696 views
file workflow


<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <record id="wkl_tangluong" model="workflow">
            <field name="name">salary.wkl</field>
            <field name="osv">salary.salary</field>
            <field name="on_create">True</field>
        </record>
        <!-- Activity -->
        <record id="act_taomoi" model="workflow.activity">
            <field name="wkf_id" ref="wkl_tangluong" />
            <field name="flow_start">True</field>
            <field name="name">taomoi</field>
            <field name="kind">function</field>
            <field name="action">action_moitao()</field>
        </record>
        <record id="act_choxemxet" model="workflow.activity">
            <field name="wkf_id" ref="wkl_tangluong" />
            <field name="name">choxemxet</field>
            <field name="kind">function</field>
            <field name="action">action_choxemxet()</field>

        </record>
        <record id="act_huy" model="workflow.activity">
            <field name="wkf_id" ref="wkl_tangluong" />
            <field name="name">huy</field>
            <field name="flowstop">True</field>
            <field name="kind">stopall</field>
            <field name="action">action_huy()</field>
        </record>
        <record id="act_chopheduyet" model="workflow.activity">
            <field name="wkf_id" ref="wkl_tangluong" />
            <field name="name">chopheduyet</field>
            <field name="kind">function</field>
            <field name="action">action_chopheduyet()</field>
        </record>
        <!-- Transition -->
        <record model="workflow.transition" id="t1">
            <field name="act_from" ref="act_taomoi" />
            <field name="act_to" ref="act_choxemxet" />
            <field name="signal">salary_dexuatduoctao</field>
        </record>

        <record id="t2" model="workflow.transition">
            <field name="act_from" ref="act_choxemxet" />
            <field name="act_to" ref="act_huy" />
            <field name="signal">salary_huydexuat</field>
        </record>
        <record id="t3" model="workflow.transition">
            <field name="act_from" ref="act_choxemxet" />
            <field name="act_to" ref="act_chopheduyet" />
            <field name="signal">salary_dexuat</field>
        </record>
    </data>
</openerp>

**<<file view.xml>>**
    <?xml version="1.0" encoding="UTF-8"?>
    <openerp>
        <data>
            <menuitem icon="terp-graph" id="salary_menu" name="Salary" />
            <record model="ir.ui.view" id="nhaplieu">
                <field name="name">salaryy.search</field>
                <field name="model">salaryy.salaryy</field>
                <field name="arch" type="xml">
                    <search string="salary search" version="7.0">
                        <field name="name" />
                        <field name="state" />
                    </search>
                </field>
            </record>
            <record model="ir.ui.view" id="view_salary_tree">
                <field name="name">salaryy.salaryy.tree</field>
                <field name="model">salaryy.salaryy</field>
                <field name="type">tree</field>
                <field name="arch" type="xml">
                    <tree string="salary tree">
                        <field name="name" />
                        <field name="state" />
                    </tree>
                </field>
            </record>
            <record model="ir.ui.view" id="view_salary_form">
                <field name="name">salaryy.salaryy.form</field>
                <field name="model">salaryy.salaryy</field>
                <field name="type">form</field>
                <field name="arch" type="xml">
                    <form string="salary form">
                        <group>
                            <field name="name" />
                            <field name="state" />
                        </group>
                        <group>
                            <button name="salary_dexuatduoctao" string="cho xem xet"
                                states="taomoi" />
                            <button name="salary_huydexuat" string="huy" states="choxemxet" />
                            <button name="tangluong_dexuat" string="chopheduyet"
                                states="choxemxet" />
                        </group>
                    </form>
                </field>
            </record>
            <record id="action_view_salary_salary_form" model="ir.actions.act_window">
                <field name="name">tao moi de xuat</field>
                <field name="res_model">salaryy.salaryy</field>
                <field name="view_type">form</field>
                <field name="view_mode">tree,form</field>
                <field name="search_view_id" ref="nhaplieu" />
            </record>
            <menuitem name="salary" parent="salary_menu" id="menu_staff"
                sequence="3" />
            <menuitem action="action_view_salary_salary_form" id="menu_view_staff_form"
                parent="menu_staff" />
        </data>
    </openerp>





 **<<file python.py>>**
     import time
        from osv import fields, osv
        class salaryy_staff (osv.osv):
            _name = "salaryy.staff"
            _columns = {
                      'name': fields.char('Name', size=64, required=True),
                      }    
            _defaults = {
                   }
        salaryy_staff()
        class salaryy_salaryy(osv.osv):
            _name = "salaryy.salaryy"
            _columns = {
                      'name': fields.char('Name', size=64, required=True),
                      'state': fields.selection ([('taomoi', 'Tao Moi'),
                                                  ('choxemxet', 'Cho Xem Xet'),
                                                  ('huy', 'Huy'),
                                                  ('chopheduyet', 'Cho Phe Duyet'),
                                                   ], 'status', readonly=False)
                      }
            _defaults = {
                    'state':'taomoi'
                       }
            def action_moitao(self, cr, uid, ids):
                self.write(cr, uid, ids, {'state': 'taomoi'})
                return True
            def action_choxemxet(self, cr, uid, ids):
                self.write(cr, uid, ids, {'state': 'choxemxet'})
                return True
            def action_huy(self, cr, uid, ids):
                self.write(cr, uid, ids, {'state': 'huy'})
                return True  
            def action_chopheduyet(self, cr, uid, ids):
                self.write(cr, uid, ids, {'state': 'chopheduyet'})
                return True
        salaryy_salaryy()

Can you be more explicit in your demand ?

Xsias
on 8/7/13, 5:25 AM

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: 7/14/13, 2:22 PM
Seen: 696 times
Last updated: 3/16/15, 8:10 AM