← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 816097] Re: product do not want default category

 

Leigh,

This was done in v6 to minimize the number of steps needed to initialize a new database. Creating/Importing the list of products is one of these steps, and it used to be quite cumbersome. Imagine you're a small business with a tiny list of products.
Providing a default umbrella product category means that you can immediately import a list of products via CSV and start using OpenERP right away, without even needing any existing product categories (say your product catalog was previously an excel sheet, common enough).

Now, I understand that this could be a source of errors later in the
process, when new products are introduced in an already configured
system. But if you want to get rid of this default, you should be able
to simply delete the "All Products" category and be done with it (it
will not be reinstalled during a later OpenERP update as it is
specifically written to be created only for new databases). If that does
not work, then I agree we have an annoying bug.

Perhaps we could also improve the implementation by making the default "umbrella category" work like a user-defined default value (same effect as in right-click > "set as default" on the field), instead of hardcoding it in the default_category() function.
But the effect would be quite similar, and you would still need to delete the category in your case (or override it with another default one)

What do you think?

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

Title:
  product do not want default category

Status in OpenERP Modules (addons):
  Opinion

Bug description:
  OpenERP REQUIRES that there is a DEFAULT product category. I do NOT
  want a default product category, I want the field to remain empty (and
  blue, because it is required) to force my users to select their
  product category.

  This is the only place that we have found where a default is required
  (the default is hard-coded to be the ALL PRODUCTS category), and this
  behavior is not consistent with the rest of OpenERP.

  The fix requires a re-write of the following function. The code
  containing 'cat0' should not exist at all - it sets the default
  category to be (the reference to) cat0 if no default exists - it
  should return nothing if no default exists.

   _default_category(self, cr, uid, context=None):
          if context is None:
              context = {}
          if 'categ_id' in context and context['categ_id']:
              return context['categ_id']
          md = self.pool.get('ir.model.data')
          res = False
          try:
              res = md.get_object_reference(cr, uid, 'product', 'cat0')[1]
          except ValueError:
              res = False
          return res

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


Follow ups

References