Community mailing list archives


V8 - Fields defaults not getting loaded in Create method

Alien Group Lda, Aires Silvestre
- 01/29/2016 07:20:14
Hello Community, I need help, please

In Odoo V8 if you create a Puchase Order using the Odoo interface you'll realize that there are some required (not null) fields that get their default values computed automatically (location_id, date_order, picking_type_id, etc) and the only field you have to enter is the vendor.

But if I try to create a Purchase Order using the ORM (by Create method) and passing only the partner_id as data all those field are not computed and therefore I get Integrity Error (
[object with reference: location_id -] ).

My code (using new API):
self.env['purchase.order'].create({'partner_id': XXX})

I now I can overcome this by passing all required fields but if they have defaults computed in the model, should not the create in ORM behave the same way?
How can I use the create and have the same required fields computed and loaded for me?

Thanks in advance and kind regards 
<img src="" alt="ALIEN GROUP LDA">

Aires Silvestre


tm.+244 925 999 331

<img src="" alt="Código QR">

Rua Doutor Agostinho Neto, 156, Bairro Azul, Luanda - Angola, Tel: +244 913 728 600 | +244 913 728 650,
Website:, Email:

<img src="" style="vertical-align:top;" alt=""> Não imprima este email caso não seja estritamente necessário. A Terra agradece-lhe!