← Back to team overview

openerp-india team mailing list archive

[Bug 931202] [NEW] [trunk] issue with inherited field when put in child and parent is required

 

Public bug reported:

Modified code
        for v in vals.keys():
            if v in self._inherit_fields:
                (table, col, col_detail, original_parent) = self._inherit_fields[v]
                tocreate[table][v] = vals[v]
                if v not in self._columns:
                    del vals[v]

Original code
        for v in vals.keys():
            if v in self._inherit_fields and v not in self._columns:
                (table, col, col_detail, original_parent) = self._inherit_fields[v]
                tocreate[table][v] = vals[v]
                del vals[v]

The cause of this problem can be demonstrated by product and
product_variant_multi module.  pvm redeclares name field as part of
product, yet both are required fields in template and product.  When
creating a product, product template creation fails because name value
is not passed to create.

Now I am not saying this is the most elegant way to fix it, and one
could argue it would be better done in the addons code, but both these
modules existed long before the code change that introduced the error.
The modified code block is how I resolved it, essentially writing the
value to both models.

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

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/931202

Title:
  [trunk] issue with inherited field when put in child and parent is
  required

Status in OpenERP Server:
  New

Bug description:
  Modified code
          for v in vals.keys():
              if v in self._inherit_fields:
                  (table, col, col_detail, original_parent) = self._inherit_fields[v]
                  tocreate[table][v] = vals[v]
                  if v not in self._columns:
                      del vals[v]

  Original code
          for v in vals.keys():
              if v in self._inherit_fields and v not in self._columns:
                  (table, col, col_detail, original_parent) = self._inherit_fields[v]
                  tocreate[table][v] = vals[v]
                  del vals[v]

  The cause of this problem can be demonstrated by product and
  product_variant_multi module.  pvm redeclares name field as part of
  product, yet both are required fields in template and product.  When
  creating a product, product template creation fails because name value
  is not passed to create.

  Now I am not saying this is the most elegant way to fix it, and one
  could argue it would be better done in the addons code, but both these
  modules existed long before the code change that introduced the error.
  The modified code block is how I resolved it, essentially writing the
  value to both models.

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


Follow ups

References