Skip to content

Commit df3accd

Browse files
mmahroussfda-odoo
authored andcommitted
[FIX] handle removal or init from packages
1 parent b484dd2 commit df3accd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/src/core/odoo.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ impl SyncOdoo {
576576
let in_addons = parent.borrow().get_main_entry_tree(session) == tree(vec!["odoo", "addons"], vec![]);
577577
let new_symbol = Symbol::create_from_path(session, &PathBuf::from(path), parent, in_addons);
578578
if new_symbol.is_some() {
579+
session.sync_odoo.must_reload_paths.retain(|(_, p)| p != path);
579580
let new_symbol = new_symbol.as_ref().unwrap().clone();
580581
new_symbol.borrow_mut().set_is_external(false);
581582
let new_sym_typ = new_symbol.borrow().typ();
@@ -587,12 +588,12 @@ impl SyncOdoo {
587588
new_symbol.borrow_mut().as_file_mut().self_import = true;
588589
},
589590
SymType::PACKAGE(PackageType::MODULE) => {},
591+
SymType::NAMESPACE => continue, // A module became a namespace, due to __init__ deletion/renaming
590592
_ => {panic!("Unexpected symbol type: {:?}", new_sym_typ);}
591593
}
592594
if matches!(new_symbol.borrow().typ(), SymType::PACKAGE(PackageType::MODULE)) {
593595
session.sync_odoo.modules.insert(new_symbol.borrow().name().clone(), Rc::downgrade(&new_symbol));
594596
}
595-
session.sync_odoo.must_reload_paths.retain(|x| !Weak::ptr_eq(&x.0, weak_sym));
596597
session.sync_odoo.add_to_rebuild_arch(new_symbol.clone());
597598
}
598599
}

0 commit comments

Comments
 (0)