← Back to team overview

openerp-india team mailing list archive

[Bug 1010032] [NEW] [6.x+trunk] context passing in product_id_change on sale.order

 

Public bug reported:

http://bazaar.launchpad.net/~openerp/openobject-
addons/6.1/view/head:/sale/sale.py#L1203

For custom code this makes it very hard and impractical to extend
functions and use context to do this.

Personally I'm involved in some code that changes how uom conversions
are done depending on the product, I was passing 'product_id' in the
context but the method product_id_change throws out the entire context
to replace it with something containing only 'lang' and 'partner_id'
ignoring any other context key/value pairs that could've been in
context.

Also note how many methods are called without passing context along:

http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/sale/sale.py#L1219
http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/sale/sale.py#L1224
http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/sale/sale.py#L1234
http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/sale/sale.py#L1262

This one is even better, it calls the pricelist with a custom context which is nothing related with the original context.
http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/sale/sale.py#L1288

I can't see how much trouble adding context to these calls would create?
But I can tell you it would make for excellent extensibility if you would pass the context around consistently.

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1010032

Title:
  [6.x+trunk] context passing in product_id_change on sale.order

Status in OpenERP Addons (modules):
  New

Bug description:
  http://bazaar.launchpad.net/~openerp/openobject-
  addons/6.1/view/head:/sale/sale.py#L1203

  For custom code this makes it very hard and impractical to extend
  functions and use context to do this.

  Personally I'm involved in some code that changes how uom conversions
  are done depending on the product, I was passing 'product_id' in the
  context but the method product_id_change throws out the entire context
  to replace it with something containing only 'lang' and 'partner_id'
  ignoring any other context key/value pairs that could've been in
  context.

  Also note how many methods are called without passing context along:

  http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/sale/sale.py#L1219
  http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/sale/sale.py#L1224
  http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/sale/sale.py#L1234
  http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/sale/sale.py#L1262

  This one is even better, it calls the pricelist with a custom context which is nothing related with the original context.
  http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/sale/sale.py#L1288

  I can't see how much trouble adding context to these calls would create?
  But I can tell you it would make for excellent extensibility if you would pass the context around consistently.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1010032/+subscriptions


Follow ups

References