← Back to team overview

openerp-india team mailing list archive

[Bug 1083778] Re: Declared a variable of type dictionary and then try to do a + = with a variable of type string in the sale.order model

 

Had same problem

I modified line 993 and 1004 changed += to =

also made change another to get warning pop up by adding the following
new line before the return at 1012

 raise osv.except_osv(_('Configuration Error!'), warning_msg)


the actual code starting at 990

        if not pricelist:
            warn_msg = _('You have to select a pricelist or a customer in the sales form !\n'
                    'Please set one before choosing a product.')
            warning_msgs = _("No Pricelist ! : ") + warn_msg +"\n\n"
        else:
            price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
                    product, qty or 1.0, partner_id, {
                        'uom': uom or result.get('product_uom'),
                        'date': date_order,
                        })[pricelist]
            if price is False:
                warn_msg = _('Cannot find a pricelist line matching this product and quantity.\n'
                       'You have to change either the product, the quantity or the pricelist.')
                warning_msgs = _("No valid pricelist line found!:") + warn_msg +"\n\n"
            else:
                result.update({'price_unit': price})
        if warning_msgs:
            warning = {
                       'title': _('Configuration Error!'),
                       'message' : warning_msgs
                    }
            raise osv.except_osv(warning_msgs,_('Configuration Error!'))
        return {'value': result, 'domain': domain, 'warning': warning}

-- 
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/1083778

Title:
  Declared a variable of type dictionary and then try to do a + = with a
  variable of type string in the sale.order model

Status in OpenERP Addons (modules):
  New

Bug description:
  Declared a dictionary method product_id_change on line 905, then later try to do a + = with another type variable str, causing the following traceback:
  Traceback (most recent call last):
     File "<input>", line 1, in <module>
  TypeError: unsupported operand type (s) for + =: 'dict' and 'str'

  Error source:
  File: sale.py
  model: sale.order.line
  method: product_id_change

   905         warning_msgs = {}

   962 
   963         if not pricelist:
   964             warn_msg = _('You have to select a pricelist or a customer in the sales form !\n'
   965                     'Please set one before choosing a product.')
   966             warning_msgs += _("No Pricelist ! : ") + warn_msg +"\n\n"

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


References