Odoo Help

0

Workflows in inheritance by prototyping (_name != _inherit)

By
Shaun Dawson
on 6/18/13, 5:46 PM 888 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?

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 6/18/13, 5:46 PM
Seen: 888 times
Last updated: 3/16/15, 8:10 AM