You're not giving any versioning information, so I take it you are reporting this for trunk.
Default values passed through the context *do* override the defaults defined in the model, but that works only when the context really contains those values! To double-check this and convince yourself, try adding the default_type value to the context of the menu action from which you reach the form view, and see how it works.
Now what you see could be a bug or simply an unsupported feature... I don't see any example of a m2o fields having a literal context passed in its declaration in the 6.1 standard addons (but there are a few one2many cases)
You may want to try the following:
- set the context in the view of the model containing the product_id m2o (at XML-level) instead of doing it in Python
- use a string literal for the context instead of a python dict, e.g:
'product_id': fields.many2one(...., context="{'default_type': 'product'}")
BTW, was this working in 6.0 on both Web and GTK clients?
Hi,
You're not giving any versioning information, so I take it you are reporting this for trunk.
Default values passed through the context *do* override the defaults defined in the model, but that works only when the context really contains those values! To double-check this and convince yourself, try adding the default_type value to the context of the menu action from which you reach the form view, and see how it works.
Now what you see could be a bug or simply an unsupported feature... I don't see any example of a m2o fields having a literal context passed in its declaration in the 6.1 standard addons (but there are a few one2many cases)
You may want to try the following: many2one( ...., context= "{'default_ type': 'product'}")
- set the context in the view of the model containing the product_id m2o (at XML-level) instead of doing it in Python
- use a string literal for the context instead of a python dict, e.g:
'product_id': fields.
BTW, was this working in 6.0 on both Web and GTK clients?
Thanks,