This question has been flagged
2335 Views

I have a class defined like this:

class mymodule_thing(osv.osv):
    _name = "mymodule.thing",
    _columns = {
        #some columns in the parent class
    }

Then, I have two children of that;

class mymodule_thing_type_a(osv.osv):
    _name = "mymodule.thing_type_a",
    _columns = {
         #some columns only in type a
    }

class mymodule_thing_type_b(osv.osv):
    _name = "mymodule.thing_type_b",
    _columns = {
         #some columns only in type a
    }

My problem is with workflow. I tried defining the same workflow on three different osvs like this:

<record model="workflow" id="wkf_mymodule_thing">
    <field name="name">mymodule_thing.wkf</field>
    <field name="osv">mymodule.thing</field>
    <field name="on_create">True</field>
</record>

<record model="workflow" id="wkf_mymodule_thing">
    <field name="name">mymodule_thing.wkf</field>
    <field name="osv">mymodule.thing_a</field>
    <field name="on_create">True</field>
</record>

<record model="workflow" id="wkf_mymodule_thing">
    <field name="name">mymodule_thing.wkf</field>
    <field name="osv">mymodule.thing_b</field>
    <field name="on_create">True</field>
</record>

but, that didn't work. (What happened was that the workflow only worked for thing_b, the last to be declared).

Defining the workflow only on mymodule.thing didn't work either. The workflow wasn't applied to the child objects.

The only way that I've figured out to do what I need is to declare three different workflows, one for the parent, and then one for each of the children. That's unmaintainable.

Any ideas?

Avatar
Discard