← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 816889] Re: Problem with related fields

 

** Changed in: openobject-server
   Importance: Undecided => Low

** Changed in: openobject-server
       Status: Incomplete => Confirmed

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

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

Title:
  Problem with related fields

Status in OpenERP Server:
  Confirmed

Bug description:
  client 6.1 rev. 1928
  server 6.1 rev. 3520

  Extension of the class product_supplierinfo by 2 Columns:

  "prod code" ----- will show the items which the supplier delivers
  "price"     ----- to show the price of the first article in the supplierpartner form

  With the new column "price" in object product_supplierinfo I can not
  save a price. The value remains at 0

  
  class product_supplierinfo(osv.osv):
      _name = "product.supplierinfo"
      _inherit = "product.supplierinfo"

      _columns = {
          'prod_code'             : fields.related('product_id', type="many2one", relation="product.template", string='Bezeichnung'),
          'price'                 : fields.related('pricelist_ids', 'price', type='float', string='Price'),
      }

  product_supplierinfo()

  
  Extension of product-formview

          <record id="product_supplierinfo_tree_view_1" model="ir.ui.view">
              <field name="name">rockel_product.supplierinfo.tree.view1</field>
              <field name="model">product.supplierinfo</field>
              <field name="type">tree</field>
              <field name="priority" eval="1"/>
              <field name="arch" type="xml">
                  <tree string="Supplier Partner Information">
         	            <field name="name"/>
         	            <field name="sequence"/>
         	            <field name="delay"/>
         	            <field name="min_qty"/>
         	            <field name="product_code"/>
         	            <field name="product_name"/>
  ------->            <field name="price"/>
        	        </tree>
              </field>
          </record>

  With above formextension i get this error:

  Environment Information : 
  System : Linux-2.6.35.13-92.fc14.i686-i686-with-fedora-14-Laughlin
  OS Name : posix
  Operating System Release : 2.6.35.13-92.fc14.i686
  Operating System Version : #1 SMP Sat May 21 17:39:42 UTC 2011
  Operating System Architecture : 32bit
  Operating System Locale : de_DE.UTF8
  Python Version : 2.7.0
  OpenERP-Client Version : 6.1-dev
  Last revision No. & ID :1928 nch@xxxxxxxxxxx-20110725063933-la4j8lwm25suiy0w
  Traceback (most recent call last):
    File "/home/openerp/trunk/server/openerp/netsvc.py", line 440, in dispatch
      result = ExportService.getService(service_name).dispatch(method, auth, params)
    File "/home/openerp/trunk/server/openerp/service/web_services.py", line 588, in dispatch
      res = fn(db, uid, *params)
    File "/home/openerp/trunk/server/openerp/osv/osv.py", line 118, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/openerp/trunk/server/openerp/osv/osv.py", line 172, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/openerp/trunk/server/openerp/osv/osv.py", line 163, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/openerp/trunk/server/openerp/osv/orm.py", line 1994, in fields_view_get
      xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx)
    File "/home/openerp/trunk/server/openerp/osv/orm.py", line 1656, in __view_look_dom_arch
      fields_def = self.__view_look_dom(cr, user, node, view_id, False, fields, context=context)
    File "/home/openerp/trunk/server/openerp/osv/orm.py", line 1605, in __view_look_dom
      fields.update(self.__view_look_dom(cr, user, f, view_id, in_tree_view, model_fields, context))
    File "/home/openerp/trunk/server/openerp/osv/orm.py", line 1558, in __view_look_dom
      field = model_fields[node.get('name')]
  KeyError: 'price'


  Extension of partner form:

         <record id="supplier_productinfo_tree_view" model="ir.ui.view">
              <field name="name">rockel.supplier.productinfo.tree.view</field>
              <field name="model">product.supplierinfo</field>
              <field name="type">tree</field>
              <field name="arch" type="xml">
                  <tree string="Supplier Product Information">
         	            <field name="prod_code"/>
         	            <field name="sequence"/>
         	            <field name="delay"/>
         	            <field name="min_qty"/>
         	            <field name="product_code"/>
         	            <field name="product_name"/>
         	        </tree>
              </field>
          </record>

          <record id="supplier_productinfo_form_view" model="ir.ui.view">
              <field name="name">rockel.supplier.productinfo.form.view</field>
              <field name="model">product.supplierinfo</field>
              <field name="type">form</field>
              <field name="arch" type="xml">
                  <form string="Supplier Product Information">
  -------->           <field name="prod_code"/>
                      <field name="sequence"/>
                      <field name="product_code"/>
                      <field name="product_name"/>
                      <field name="delay"/>
                      <field name="min_qty"/>
                      <field colspan="4" groups="base.group_extended" name="pricelist_ids" nolabel="1" widget="one2many_list">
                          <tree editable="bottom" string="Pricelist">
                              <field name="min_quantity"/>
                              <field name="price"/>
                          </tree>
                          <form>
                              <field name="min_quantity"/>
                              <field name="price"/>
                          </form>
                      </field>
                  </form>
              </field>
          </record>

  When i press the search button in field prod_code in
  supplier_productinfo_form_view i get this error:

  Environment Information : 
  System : Linux-2.6.35.13-92.fc14.i686-i686-with-fedora-14-Laughlin
  OS Name : posix
  Operating System Release : 2.6.35.13-92.fc14.i686
  Operating System Version : #1 SMP Sat May 21 17:39:42 UTC 2011
  Operating System Architecture : 32bit
  Operating System Locale : de_DE.UTF8
  Python Version : 2.7.0
  OpenERP-Client Version : 6.1-dev
  Last revision No. & ID :1928 nch@xxxxxxxxxxx-20110725063933-la4j8lwm25suiy0w
  Traceback (most recent call last):
    File "/home/openerp/trunk/server/openerp/netsvc.py", line 440, in dispatch
      result = ExportService.getService(service_name).dispatch(method, auth, params)
    File "/home/openerp/trunk/server/openerp/service/web_services.py", line 588, in dispatch
      res = fn(db, uid, *params)
    File "/home/openerp/trunk/server/openerp/osv/osv.py", line 118, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/home/openerp/trunk/server/openerp/osv/osv.py", line 172, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/home/openerp/trunk/server/openerp/osv/osv.py", line 163, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/home/openerp/trunk/server/openerp/osv/orm.py", line 1994, in fields_view_get
      xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx)
    File "/home/openerp/trunk/server/openerp/osv/orm.py", line 1656, in __view_look_dom_arch
      fields_def = self.__view_look_dom(cr, user, node, view_id, False, fields, context=context)
    File "/home/openerp/trunk/server/openerp/osv/orm.py", line 1605, in __view_look_dom
      fields.update(self.__view_look_dom(cr, user, f, view_id, in_tree_view, model_fields, context))
    File "/home/openerp/trunk/server/openerp/osv/orm.py", line 1558, in __view_look_dom
      field = model_fields[node.get('name')]
  KeyError: 'prod_code'


  In Version 6.02 it works.

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


References