← Back to team overview

openerp-india team mailing list archive

[Bug 947670] [NEW] [6.1] GTK Client whitespace trimming (or maybe module, or maybe framework)

 

Public bug reported:

If you look at this function (although there are many more) the GTK
client trims the whitespace in the return causing errors when the field
only contains whitespace and annoying errors when it doesn't.  This
example os from sale_layout, however many other modules have a similar
requirement to support whitespace e.g. ' - ' gets trimmed to just '-' by
GTK in product_variant_multi so I report for GTK rather than specific
module.

Note I am only assuming it is GTK behaviour as it doesn't exhibit when
the value is set by defaults, but does when triggered by onchange or
user input

    def onchange_sale_order_line_view(self, cr, uid, id, type, context={}, *args):
        temp = {}
        temp['value'] = {}
        if (not type):
            return {}
        if type != 'article':
            temp = {
                'value': {
                'product_id': False,
                'uos_id': False,
                'account_id': False,
                'price_unit': 0.0,
                'price_subtotal': 0.0,
                'quantity': 0,
                'discount': 0.0,
                'invoice_line_tax_id': False,
                'account_analytic_id': False,
                'product_uom_qty': 0.0,
                },
            }
            if type == 'line':
                temp['value']['name'] = ' '
            if type == 'break':
                temp['value']['name'] = ' '
            if type == 'subtotal':
                temp['value']['name'] = 'Sub Total'
            return temp
        return {}

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

** Project changed: openobject-addons => openobject-client

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

Title:
  [6.1] GTK Client whitespace trimming (or maybe module, or maybe
  framework)

Status in OpenERP GTK Client:
  New

Bug description:
  If you look at this function (although there are many more) the GTK
  client trims the whitespace in the return causing errors when the
  field only contains whitespace and annoying errors when it doesn't.
  This example os from sale_layout, however many other modules have a
  similar requirement to support whitespace e.g. ' - ' gets trimmed to
  just '-' by GTK in product_variant_multi so I report for GTK rather
  than specific module.

  Note I am only assuming it is GTK behaviour as it doesn't exhibit when
  the value is set by defaults, but does when triggered by onchange or
  user input

      def onchange_sale_order_line_view(self, cr, uid, id, type, context={}, *args):
          temp = {}
          temp['value'] = {}
          if (not type):
              return {}
          if type != 'article':
              temp = {
                  'value': {
                  'product_id': False,
                  'uos_id': False,
                  'account_id': False,
                  'price_unit': 0.0,
                  'price_subtotal': 0.0,
                  'quantity': 0,
                  'discount': 0.0,
                  'invoice_line_tax_id': False,
                  'account_analytic_id': False,
                  'product_uom_qty': 0.0,
                  },
              }
              if type == 'line':
                  temp['value']['name'] = ' '
              if type == 'break':
                  temp['value']['name'] = ' '
              if type == 'subtotal':
                  temp['value']['name'] = 'Sub Total'
              return temp
          return {}

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


Follow ups

References