Mario Župan
Mario Župan

Reputation: 13

OpenERP OpenObject processes

I read about processes and I think they are a great help to users. Now I want to create a process for my experimental module. I'm looking into sale_process.xml and the first record references the sale module. Where is can I find model_sale_order?

<record id="process_process_salesprocess0" model="process.process">
    <field eval="1" name="active"/>
    <field name="model_id" ref="sale.model_sale_order"/>
    <field eval="&quot;&quot;&quot;Sales&quot;&quot;&quot;" name="name"/>
</record>

Upvotes: 1

Views: 641

Answers (1)

Don Kirkby
Don Kirkby

Reputation: 56590

I believe that's pointing to the ir_model_data record with name 'model_sale_order' and module 'sale'. That record in turn points to the ir_model record for the sale_order table that has a child record for each field. All of these records are generated based on the details defined in the sale_order class. One of the key features of each model class is the _columns dictionary. The developer documentation has a pretty good description in its chapter on Objects, Fields, and Methods.

If you are adding a few fields to the standard 'sale.order' model (inheriting), then your module will use the same 'sale.model_sale_order' record and just add a few more child records for your new fields. You can continue to reference 'sale.model_sale_order' when you add to the process definition.

If you are creating a separate model and not inheriting, then don't use the 'sale.order' name in your model class. Use a name like 'mysale.order'. That will automatically generate a new 'mymodule.model_mysale_order' record, and you can reference that in the process definition.

Upvotes: 2

Related Questions