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.

1

default value behavior

By
Pierre Girard
on 3/22/13, 11:12 AM 1,738 views

Hello everyone and thank for any answer.

I have inherited the sale.order object which have a sequence on the name field value.

my problem is that the default value for the name seems to be call 2 time(the get function of the sequence is.) but i don't see anywhere in my code where it could be called twice...

what happend is when i create a new order the default value is called and when i save(or use any button) it's seem to be call again...

i work with openerp 6.1 on ubuntu 12.04

here a bonus question:

I found a new attribute for the xml that i never saw before and i would like to someone to give me some direction to learn what it do and how to use it.

options="{'quick_create': False}"

i found this as an xml field attribute, thank for any help!

Maybe this can give you some more information about your bonus question? https://bugs.launchpad.net/openerp-web/+bug/1013079

Laurens
on 3/22/13, 11:18 AM
2

Fabien Pinckaers (fp)

--Fabien Pinckaers (fp)--
6598
| 6 8 8
fsdsdfsdf, Belgium
--Fabien Pinckaers (fp)--

Odoo Founder & CEO

Fabien Pinckaers (fp)
On 3/28/13, 3:45 PM

Here is why it could be called twice:

  • When doing a default_get, you get the first call
  • If your name field is readonly, the client will not send the value to the server when creating the record
  • When creating the record, the server will call default_get on this field as it did not received any value to store in the name field.

actually i did put the name in readonly ... thank a lot, it explain why!

Pierre Girard
on 3/28/13, 4:20 PM
0
Pierre Girard
On 3/28/13, 10:20 AM

Finaly, i did not find why the default value was called two time, but i found a way to bypass my problem anyway.

i think the problem come from the fact that i tried to create a second view for a same model(sale.order), so i check other model who have two or more view.

It appear that these model (the one i check is stock.picking) call the sequence in the create function instead of a default value like sale.order. so, in my inheritance of sale.order i modify the default value for the name and inherit the create function, and that's it!

Laurent, thank you for your answer on my bonus question, it didn't give all that i need but it help a little.

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

0 follower(s)

Stats

Asked: 3/22/13, 11:12 AM
Seen: 1738 times
Last updated: 3/16/15, 8:10 AM