I used self.env.context.get('secondary_qty') to fetched the pieces but why it returns None?
What are the possible reasons that it will return None ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I used self.env.context.get('secondary_qty') to fetched the pieces but why it returns None?
What are the possible reasons that it will return None ?
Hi,
Self.env.context.get() method is used in order to check whether that key is present in our context. So make sure that your context have this field and its value. Just try to print the context and check the field and its values is there.
context = self.env.context
if context.get('secondary_qty'):
print("YES")
other operations
Yes,thank u, the field I'm trying to fetch doesn't have any value
Hi,
Since secodary qty is note default context, please check if you pass the context before calling the method. To pass the context you can use with_context() method
ex:
self.with_context(secondary_qty='value').write()
I think you can also print out self.env.context to check what context you have.
Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!
Inscreva-sePublicações relacionadas | Respostas | Visualizações | Atividade | |
---|---|---|---|---|
Problem using "self.env.user"
Resolvido
|
|
2
jan. 18
|
8664 | |
|
2
set. 24
|
44 | ||
|
2
ago. 24
|
1449 | ||
self search based on field
Resolvido
|
|
2
fev. 23
|
12633 | |
|
0
fev. 23
|
2822 |
Hello, did you solve this problem? Cause right now, Im facing similar problem