← Back to team overview

credativ team mailing list archive

[Bug 1200888] Re: Bug migrating 'mail' module due to a view associated to 'base' module. ('base.view_crm_partner_info_History')

 

Hi  !

I had temporarily solved the problem doing the following. But i'm not very proud of my code (you'll see bellow), but it work... ;-(
I think your idea is better. We have to modify the core's code, or we can do that in openupgrade.py using overloading or something like that ?

By the way, maybe we can have the same problem for other kind of object
no ? like ir.actions.client, or menuitem ...


*** openupgrade-server / ... / base / .../ pre-migration.py ***
xmlid_deletions = [
    {
        'table_name' : 'ir_ui_view',
        'module' : 'base',
        'name' : 'view_crm_partner_info_History',
    },
]
# ...
@openupgrade.migrate()
def migrate(cr, version):
    # ....
    openupgrade.delete_model_by_xmlid(cr, xmlid_deletions)
    #...

*** openupgrade-server / ... / openupgrade / openupgrade.py ***

def delete_model_by_xmlid(cr, xmlids):
    for xmlid in xmlids:
        cr.execute("""SELECT id, res_id FROM ir_model_data WHERE module='%s' and name='%s'""" %(xmlid['module'], xmlid['name']))
           
        for row in cr.fetchall():
            # deleting reference in ir_model_data
            cr.execute( "DELETE FROM ir_model_data WHERE id='%s' AND module='%s' AND name='%s'" %(row[0], xmlid['module'], xmlid['name']))

            # Deleting the object
            cr.execute("DELETE FROM %s WHERE id='%s'" %(xmlid['table_name'], row[1])

-- 
You received this bug notification because you are a member of
OpenUpgrade Committers, which is subscribed to OpenUpgrade Server.
https://bugs.launchpad.net/bugs/1200888

Title:
  Bug migrating 'mail' module due to a view associated to 'base' module.
  ('base.view_crm_partner_info_History')

Status in OpenUpgrade Server:
  New

Bug description:
  Hi

  I have a problem doing the migration of 'mail' module.

  It's about the view 'base.view_crm_partner_info_History' (inherits 'base.view_partner_form') in 6.1. 
  (In 7.0, the view doesn't exist anymore.)

  *** Reproduce the bug :
  - install a 6.1 database without module (juste 'base') & run openupgrade server ; 
  - OpenUpgrade: 'base' pre-migration : OK
  - openerp.modules.modules : init_module_models : OK
  - openerp.modules.loading : loading XML files : OK
  - OpenUpgrade: 'base' post-migration : OK
  - all is OK.

  - re install a 6.1 database, installing 'mail' module & run openupgrade server ; 
  - OpenUpgrade: 'base' pre-migration : OK
  - openerp.modules.modules : init_module_models : OK
  - openerp.modules.loading : loading XML files : --- FAIL ---

  View definition error for inherited view
  'base.view_crm_partner_info_History' on model 'res.partner': Element
  '<xpath expr="/form/notebook/page[@string='History']">' not found in
  parent view 'base.view_partner_form'

  I think that the problem is the following : 
  - 'view_crm_partner_info_History' is associated to 'base' but not created by 'base' module ; 
  - The view is in fact created by 'mail' (or 'marketing_campaign' / 'crm_claim' / 'project' module.)
  - the openupgrade has no time to pass in 'mail' pre-migration.py script, it fail before.

  *** Solution (?): 
  - 'base' pre-migration.py have to delete this view.(if exist)
  It's not very clean 'cause it's not the 'problem' of 'base' module...

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


References