Odoo Help

Welcome!

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

0

Setting default values for fields coming from "inherits" not working

By
Mathieu Laflamme
on 5/9/16, 5:35 PM 442 views

I don't understand why my default values that I set in models I inherits from somewhere elses doesn't work. In other words, default="DEFAULT TEXT" doesn't work in entities I will eventually inherits from. 

Why isn't working... and what would be the alternative? I tried setting only the the default property on the destination model, but odoo complains this is not valid. Any other idea?

Thanks

0

Prakash Sharma

--Prakash Sharma--
815
| 2 1 4
Delhi, India
--Prakash Sharma--

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

Prakash Sharma
On 5/10/16, 2:16 AM

 Regarding:what would be the alternative

Override the default_get Like:

def default_get(self,cr,uid,fields,context):
res=super(multi_package_shipment_wizard,self).default_get(cr,uid,fields,context)
#Now update the res here.


In ODOO Admin can also set the default value of fields from   Setting->Technical->Actions->User defined Defaults .
For example for setting default account_id in account.invoice :

  1. Go to Setting->Technical->Actions->User defined Defaults.

  2. Create a record  for your model.

  3. Inside name place your filed name(account_id).

  4. Inside model place your model name(account.invoice).

  5. inside Default value  place the default value (id_number) 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/9/16, 5:35 PM
Seen: 442 times
Last updated: 5/10/16, 2:16 AM