← Back to team overview

openerp-india team mailing list archive

[Bug 1012181] Re: [6.1] fields.related and store=True, changes are not propagated

 

Yann,

As you have set the field related to be store=True,  system is supposed
to do any changes to other fields only after the value of city_id
changes(like change to false, or any other city), but not any internal
changes inside the city.

I just faced it few days back.

In order to overcome,you may either opt to go for onchange() or can try
store={}.

Hope this helps.

Thanks.

** Changed in: openobject-server
       Status: New => Invalid

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

Title:
  [6.1] fields.related and store=True, changes are not propagated

Status in OpenERP Server:
  Invalid

Bug description:
  For example (based on city module)

  class city(osv.osv):

  # custom  name_get ...
  # custom  name_search ...

      _name = 'city.city'
      _description = 'City'
      _columns = {
          'state_id': fields.many2one('res.country.state', 'State',
              domain="[('country_id','=',country_id)]", select=1),
          'name': fields.char('City', size=64, required=True, select=1),
          'zip': fields.char('ZIP', size=64, required=True, select=1),
          'country_id': fields.many2one('res.country', 'Country', select=1),
          'code': fields.char('City Code', size=64,
              help="The official code for the city"),
      }
  city()


  To not loose backward compatibility with other modules that will look
  for zip, country_id or city fields, we add in our module:

  class res_partner_address(osv.osv):
      _inherit = "res.partner.address"
      _columns = {
          'city_id': fields.many2one('city.city', 'Location', select=1),
          'zip': fields.related('city_id', 'zip', type="char", string="Zip",
                                 store=True),
          'city': fields.related('city_id', 'name', type="char", string="City",
                                 store=True),
          'state_id': fields.related('city_id', 'state_id', type="many2one",
                                     relation="res.country.state", string="State",
                                     store=True),
          'country_id': fields.related('city_id', 'country_id', type="many2one",
                                       relation="res.country", string="Country",
                                       store=True),
      }
  res_partner_address()

  An finally we operate a view change like this:
              <data>
                  <xpath expr="//field[@name='address']//field[@name='city']" position="replace">
                      <field name="city_id" colspan="4" />
                  </xpath>
                  <xpath expr="//field[@name='address']//field[@name='country_id']" position="replace"/>
                  <xpath expr="//field[@name='address']//field[@name='zip']" position="replace"/>
                  <xpath expr="//field[@name='address']//field[@name='state_id']" position="replace"/>
              </data>

  ===========================================================================

  Now, we have this new object "city.city". If I decide to edit the
  "city.city" object field named "zip" and press save, it will not
  update the stored 'zip' field of the "res.partner" that is linked to
  this "city.city" object.

  Is that normal ? changes should be propagated to all related fields!

  (note: to update the partner with correct data, I have to go to its
  form, edit one field to allow the save button to become red and
  finally press save to update it)

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


References