← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 693102] Re: yml one2many records not deleted on uninstall

 

Hello,

Thanks for your support! It is a very good idea. Unfortunately prior to
complexity of the problem, we will not consider it for current version.
But we will definitely consider it as feature for future road maps.

Thanks.

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

** Changed in: openobject-server
       Status: New => 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/693102

Title:
  yml one2many records not deleted on uninstall

Status in OpenObject Server:
  Confirmed

Bug description:
  If a module's yml !record creates additional one2many related records, 
like this example creates both a res.partner record and a related res.partner.address,
the related record is not given a module ref id (ir_model_data.name),
thus will not be deleted upon module uninstall.
-
  !record {model: res.partner, id: res_partner_markjohnson0}:
    address:
      - city: paris
        country_id: base.fr
        name: Mark Johnson
        street: 1 rue Rockfeller
        type: invoice
        zip: '75016'
    name: Mark Johnson
-

When YamlInterpreter::_eval_field::one2many is called, 
it does the _create_record,
but fails to follow with a ir.model.data create/update,
like the parent record's process_record does properly.
___
class YamlInterpreter(object):

    # ...

    def _eval_field(self, model, field_name, expression):

        # ...

        elif column._type == "one2many":
            other_model = self.get_model(column._obj)
            value = [(0, 0, self._create_record(other_model, fields)) for fields in expression]
            ### Should be code here to create ir.model.data ... ###

    # ...

    def process_record(self, node):
            ...
            id = self.pool.get('ir.model.data')._update(self.cr, self.uid, record.model, \
                    self.module, record_dict, record.id, noupdate=self.isnoupdate(record), mode=self.mode, context=context)
           ### ... like this does correctly ###
___

I don't know if it's legal to create an ir.model.data with a blank ir_model_data.name,
If not, perhaps it could be an enumerated suffix could be added to the parent record's ir_model_data.name?

Or perhaps this could be handled using cascading deletes?  Not?

Workaround: don't use the automatic one2many facility; created all !records individually and relate using module ref id's.

I volunteer to propose a patch, if assigned a mentor.





References