@@ -501,10 +501,10 @@ def _up(table, old, new):
501
501
cr .execute ("DELETE FROM ir_module_module_dependency WHERE name=%s" , [old ])
502
502
cr .execute ("DELETE FROM ir_model_data WHERE model='ir.module.module' AND res_id=%s" , [mod_ids [old ]])
503
503
if state in INSTALLED_MODULE_STATES :
504
- force_install_module (cr , into )
504
+ force_install_module (cr , into , reason = "installed {!r} module has been merged into it" . format ( old ) )
505
505
506
506
507
- def force_install_module (cr , module , if_installed = None ):
507
+ def force_install_module (cr , module , if_installed = None , reason = "it has been explicitly asked for" ):
508
508
"""
509
509
Force the ORM to install a module.
510
510
@@ -549,6 +549,14 @@ def force_install_module(cr, module, if_installed=None):
549
549
states = dict (cr .fetchall ())
550
550
toinstall = [m for m in states if states [m ] == "to install" ]
551
551
552
+ if module in toinstall :
553
+ _logger .info (
554
+ "force install of module %r (and its dependencies) because %s%s" ,
555
+ module ,
556
+ reason ,
557
+ " and modules {!r} are already installed" .format (if_installed ) if if_installed else "" ,
558
+ )
559
+
552
560
# auto_install modules...
553
561
if AUTO_INSTALL in ("all" , "only_link_modules" ) and toinstall :
554
562
# Same algo as ir.module.module.button_install(): https://git.io/fhCKd
@@ -607,8 +615,11 @@ def force_install_module(cr, module, if_installed=None):
607
615
[toinstall , list (INSTALLED_MODULE_STATES )],
608
616
)
609
617
for (mod ,) in cr .fetchall ():
610
- _logger .debug ("auto install module %r due to module %r being force installed" , mod , module )
611
- force_install_module (cr , mod )
618
+ force_install_module (
619
+ cr ,
620
+ mod ,
621
+ reason = "it is an auto install module and its dependency {!r} has been force installed" .format (module ),
622
+ )
612
623
613
624
# TODO handle module exclusions
614
625
@@ -648,7 +659,7 @@ def new_module_dep(cr, module, new_dep):
648
659
if mod_state in INSTALLED_MODULE_STATES :
649
660
# Module was installed, need to install all its deps, recursively,
650
661
# to make sure the new dep is installed
651
- force_install_module (cr , module )
662
+ force_install_module (cr , new_dep , reason = "it's a new dependency of {!r}" . format ( module ) )
652
663
653
664
654
665
def remove_module_deps (cr , module , old_deps ):
@@ -755,7 +766,7 @@ def trigger_auto_install(cr, module):
755
766
756
767
cr .execute (query , [module , INSTALLED_MODULE_STATES ])
757
768
if cr .rowcount :
758
- force_install_module (cr , module )
769
+ force_install_module (cr , module , reason = "it's an auto install module and all its dependencies are installed" )
759
770
return True
760
771
return False
761
772
0 commit comments