工作流标题,舞台上没有颜色

时间:2014-03-03 10:33:04

标签: colors header workflow openerp-7

大家好我有问题我做了一个工作流程,但阶段不改变颜色。

这是工作流程

<!--########################################## workflow ########################################-->

    <record model="workflow" id="wkf_clinica">
        <field name="name">workflow.clinica</field>
        <field name="osv">gs.pet</field>
        <field name="on_create">True</field>
    </record>

    <!--##################################### Activity #############################################-->

    <record model="workflow.activity" id="act_new">
        <field name="wkf_id" ref="wkf_clinica" />
        <field name="flow_start">True</field>
        <field name="name">novo</field> 
    </record>

<record model="workflow.activity" id="act_regist">
        <field name="wkf_id" ref="wkf_clinica" />
        <field name="name">registado</field>
        <field name="kind">function</field> 
    <field name="action">pet_regist()</field>
</record>


<record model="workflow.activity" id="act_validate">
        <field name="wkf_id" ref="wkf_clinica" />
        <field name="name">validado</field>
        <field name="kind">function</field>
        <field name="action">pet_validate()</field>
</record>

<record model="workflow.activity" id="act_dead">
        <field name="wkf_id" ref="wkf_clinica" />
        <field name="name">morto</field>
         <field name="flow_stop">True</field>
        <field name="kind">function</field>
        <field name="action">pet_dead()</field>
</record>

<!--##################################### Transition #############################################-->
<record model="workflow.transition" id="new_to_regist">
        <field name="act_from" ref="act_new" />
        <field name="act_to" ref="act_regist" />
        <field name="signal">pet_regist</field>
</record>

<record model="workflow.transition" id="regist_to_validate">
        <field name="act_from" ref="act_regist" />
        <field name="act_to" ref="act_validate" />
        <field name="signal">pet_validate</field>
</record>

<record model="workflow.transition" id="validate_to_dead">
        <field name="act_from" ref="act_validate" />
        <field name="act_to" ref="act_dead" />
        <field name="signal">pet_dead</field>
</record>

班级是这个

class gs_pet(osv.osv):

_name = 'gs.pet'

_columns= {
           'pet_id': fields.char('Código', size=20, required='True'),
           'name': fields.char('Nome', size=60, required='True'),
           'owner_id':fields.many2one('gs.owner','ID_owner'),
           'register_data': fields.date('Data de Registo', required='True'),
           'gender':fields.selection([('male','Male'),('female','Female')],'Gender',required='True'),
           'born_date':fields.date('Data de Nascimento',required='True'),
           'imagemPet': fields.binary('Imagem'),
            'active': fields.boolean('Activo'),
            'state':fields.selection([('novo','Novo'),('registado','Registado'),
                                       ('validado','Validado'),('morto','Morto')],
                                      'status',readonly=True,required='True',track_visibility='onchange')
           }

_defaults = {
             'active': True,
            'state':'novo'
             }

_sql_constraints = [
                    ('code_uniq','unique(pet_id)','Id Pet repetido.')
                    ]
def pet_new(self, cr, uid, ids):
    self.write(cr, uid, ids, {'state': 'novo'})
    return True

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

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

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

gs_pet()

在视图上我有这个

 <record id="view_pets_form" model="ir.ui.view">
        <field name="name">Pets</field>
        <field name="model">gs.pet</field>
        <field eval="0" name="priority"/>
        <field name="type">form</field>
        <field name="arch" type="xml">



            <form string="Pets" version="7.0">

            <header>

            <button name="pet_regist" string="Registar" status="registado" class="oe_highlight" type="workflow" />


            <field name="state" widget="statusbar" statusbar_visible="novo,registado"               statusbar_colors='{"novo":"blue",
                    "registado":"blue",
                    "validado":"blue",
                    "morto":"blue"}' />
    </header>

无法弄清楚发生了什么......第一个状态“novo”都没有出现在蓝色

0 个答案:

没有答案