← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 778152] [NEW] [stable 6.0] stock/wizard/stock_partial_picking.py has bad currency determination as uses optional field to determine value with no failsafe

 

Public bug reported:

The offending function is this one

    def __create_partial_picking_memory(self, picking, pick_type):
        move_memory = {
            'product_id' : picking.product_id.id, 
            'quantity' : picking.product_qty, 
            'product_uom' : picking.product_uom.id, 
            'prodlot_id' : picking.prodlot_id.id, 
            'move_id' : picking.id, 
        }
    
        if pick_type == 'in':
            move_memory.update({
                'cost' : picking.product_id.standard_price, 
                'currency' : picking.product_id.company_id.currency_id.id, 
            })

When creating a product company is an optional field.  Especially useful
in multicompany, however when looking for currency it uses this field to
find it.  Moreover this is incorrect anyhow as new security rules
introduced to share partners and products means that it is looking
potentially at the wrong company to determine currency for the move.

If a company is not set, you receive a NoneType error.

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

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/778152

Title:
  [stable 6.0] stock/wizard/stock_partial_picking.py has bad currency
  determination as uses optional field to determine value with no
  failsafe

Status in OpenERP Modules (addons):
  New

Bug description:
  The offending function is this one

      def __create_partial_picking_memory(self, picking, pick_type):
          move_memory = {
              'product_id' : picking.product_id.id, 
              'quantity' : picking.product_qty, 
              'product_uom' : picking.product_uom.id, 
              'prodlot_id' : picking.prodlot_id.id, 
              'move_id' : picking.id, 
          }
      
          if pick_type == 'in':
              move_memory.update({
                  'cost' : picking.product_id.standard_price, 
                  'currency' : picking.product_id.company_id.currency_id.id, 
              })

  When creating a product company is an optional field.  Especially
  useful in multicompany, however when looking for currency it uses this
  field to find it.  Moreover this is incorrect anyhow as new security
  rules introduced to share partners and products means that it is
  looking potentially at the wrong company to determine currency for the
  move.

  If a company is not set, you receive a NoneType error.


Follow ups

References