Skip to content

Commit a2b162f

Browse files
mmahroussfda-odoo
authored andcommitted
[IMP] check for OLS05051 in env_ref hook
1 parent 2f2ba0f commit a2b162f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

server/src/core/python_arch_eval_hooks.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,14 @@ impl PythonArchEvalHooks {
12351235
let mut xml_id_split = xml_id_str.split('.');
12361236
let module_name = xml_id_split.next().unwrap();
12371237
let xml_id = xml_id_split.collect::<Vec<&str>>().join(".");
1238+
if in_validation && xml_id.contains(".") { // invalid xml_id format, should not contain any dots, i.e. module.xml_id
1239+
if let Some(diagnostic) = create_diagnostic(session, DiagnosticCode::OLS05051, &[]) {
1240+
diagnostics.push(Diagnostic {
1241+
range: FileMgr::textRange_to_temporary_Range(&xml_id_expr.range()),
1242+
..diagnostic
1243+
});
1244+
}
1245+
}
12381246
let module = session.sync_odoo.modules.get(module_name).cloned();
12391247
if module.is_none() {
12401248
if in_validation {

server/tests/data/addons/module_for_diagnostics/models/bike_parts_wheel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ def _compute_bike_weight(self):
2828
self.env.ref('bike_wheel_DOES_NOT_EXIST') # OLS05002
2929
self.env.ref('module_for_diagnostics.bike_wheel_6') # Ok
3030
self.env.ref('WRONG_MODULE.bike_wheel_6') # OLS05003
31+
self.env.ref('module_for_diagnostics.bike_wheel_6.too.many.dots') # OLS05051

0 commit comments

Comments
 (0)