The context of self is a frozendict. Is there a way to change this context of self or is there another way to alter context in odoo v8 ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
1
Beantwoorden
7528
Weergaven
by using self.with_context you can add context value.
Passing single value: self = self.with_context(default_partner_id: partner_id)Note:you need to re-assign the changed context to self. If this is not done, then the context will not be passed to other functionalities.
Passing multiple value as a dictionary (ctx) self = self.with_context(ctx)
Code available @ github: https://github.com/odoo/odoo/blob/8.0/openerp/models.py#L5266-L5283
def with_context(self, *args, **kwargs):
""" with_context([context][, **overrides]) -> records
Returns a new version of this recordset attached to an extended
context.
The extended context is either the provided ``context`` in which
``overrides`` are merged or the *current* context in which
``overrides`` are merged e.g.::
# current context is {'key1': True}
r2 = records.with_context({}, key2=True)
# -> r2._context is {'key2': True}
r2 = records.with_context(key2=True)
# -> r2._context is {'key1': True, 'key2': True}
"""
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
|
1
jan. 25
|
898 | ||
|
0
apr. 24
|
1465 | ||
|
4
nov. 23
|
5423 | ||
|
0
okt. 23
|
1208 | ||
|
0
dec. 22
|
2157 |