openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #17506
[Bug 1075702] [NEW] bug in rml_parse.set_context method
Public bug reported:
There is a conditional call to setCompany method which is not
bulletproof.
Here is the original code:
=============================================================================
if objects and len(objects) == 1 and objects[0].exists() and 'company_id' in objects[0] and objects[0].company_id:
self.setCompany(objects[0].company_id)
=============================================================================
This works fine if the company_id field points to res.company model, but if that's not the case, well then we have a problem.
So, my suggestion is to add additional check to see if we have correct model.
=============================================================================
if objects and len(objects) == 1 and objects[0].exists() and 'company_id' in objects[0] and objects[0].company_id and objects[0].company_id._model._name == 'res.company':
self.setCompany(objects[0].company_id)
=============================================================================
This is found in the openerp version 6.1
Cheers,
Petar
** Affects: openobject-server
Importance: Undecided
Status: New
** Description changed:
There is a conditional call to setCompany method which is not
bulletproof.
Here is the original code:
- ============================================================================================
+ =============================================================================
if objects and len(objects) == 1 and objects[0].exists() and 'company_id' in objects[0] and objects[0].company_id:
- self.setCompany(objects[0].company_id)
- ============================================================================================
+ self.setCompany(objects[0].company_id)
+ =============================================================================
This works fine if the company_id field points to res.company model, but if that's not the case, well then we have a problem.
So, my suggestion is to add additional check to see if we have correct model.
- ============================================================================================
+ =============================================================================
if objects and len(objects) == 1 and objects[0].exists() and 'company_id' in objects[0] and objects[0].company_id and objects[0].company_id._model._name == 'res.company':
- self.setCompany(objects[0].company_id)
- ============================================================================================
+ self.setCompany(objects[0].company_id)
+ =============================================================================
This is found in the openerp version 6.1
Cheers,
Petar
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1075702
Title:
bug in rml_parse.set_context method
Status in OpenERP Server:
New
Bug description:
There is a conditional call to setCompany method which is not
bulletproof.
Here is the original code:
=============================================================================
if objects and len(objects) == 1 and objects[0].exists() and 'company_id' in objects[0] and objects[0].company_id:
self.setCompany(objects[0].company_id)
=============================================================================
This works fine if the company_id field points to res.company model, but if that's not the case, well then we have a problem.
So, my suggestion is to add additional check to see if we have correct model.
=============================================================================
if objects and len(objects) == 1 and objects[0].exists() and 'company_id' in objects[0] and objects[0].company_id and objects[0].company_id._model._name == 'res.company':
self.setCompany(objects[0].company_id)
=============================================================================
This is found in the openerp version 6.1
Cheers,
Petar
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1075702/+subscriptions
Follow ups
References