← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 776458] [NEW] missing default on m2o field, widget=selection

 

Public bug reported:

Hi, I'm reporting this in openobject-server as I suspect it is a general
framework issue. (v6)

If we take a m2o field that has a 'selection' widget in the view, for
example the shop in the sale order, then if there are i.e. two shops,
but the first one can't be correctly visualized because of multi-company
rules or other things, then by default we get an empty value, instead of
the first usable one.

In that case the first shop cannot be visualized because of i.e.
multicompany rules, I expect to see the second one, not an empty string.

In that specific case, a workaround is adding

_defaults = {
        'shop_id': lambda self, cr, uid, context: self.pool.get('sale.shop').search(cr, uid, [])[0],
}

to the sale.order definition. However this seems to be a workaround for
a bug that does exist somewhere in the framework.

thanks!

** Affects: openobject-server
     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/776458

Title:
  missing default on m2o field, widget=selection

Status in OpenERP Server:
  New

Bug description:
  Hi, I'm reporting this in openobject-server as I suspect it is a
  general framework issue. (v6)

  If we take a m2o field that has a 'selection' widget in the view, for
  example the shop in the sale order, then if there are i.e. two shops,
  but the first one can't be correctly visualized because of multi-
  company rules or other things, then by default we get an empty value,
  instead of the first usable one.

  In that case the first shop cannot be visualized because of i.e.
  multicompany rules, I expect to see the second one, not an empty
  string.

  In that specific case, a workaround is adding

  _defaults = {
          'shop_id': lambda self, cr, uid, context: self.pool.get('sale.shop').search(cr, uid, [])[0],
  }

  to the sale.order definition. However this seems to be a workaround
  for a bug that does exist somewhere in the framework.

  thanks!


Follow ups

References