Take the 2-minute tour ×

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 eval="&quot;&quot;&quot;Sales&quot;&quot;&quot;" name="name"/>
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
I was looking at sale_order class and I didn't find anything. In _columns I can't find nothing that start with the word "model". If the class somehow generate column model_sale_order, I think it supposed to be present in database as column? –  Mario Župan May 4 '12 at 4:31
'model_sale_order' is just a name, @MarioŽupan, that other modules can use to refer to the sale_order table and its details. It's not a column. I tried to clarify my answer a bit. –  Don Kirkby May 4 '12 at 16:34
Where is defined that name? I want to change it, for example to my_model. –  Mario Župan May 6 '12 at 20:07
I think, @MarioŽupan, that the name is automatically generated based on the model class's name. So the 'sale.order' class would generate a record called 'model_sale_order', and the 'account.invoice' class would generate a record called 'model_account_invoice'. I don't think you can change it, and I'm not sure why you would want to. –  Don Kirkby May 7 '12 at 4:28
I copy the whole class sale.order to the my module try to reference to mymodule.sale_order and got error after I refresh and try to install my module. ValueError: No such external ID currently defined in the system: mymodule.sale_order I want to figure out how to create a process for my module. –  Mario Župan May 7 '12 at 18:42
show 3 more comments

Your Answer


