Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/src/core/diagnostic_codes_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ OLS03022, DiagnosticSetting::Error, "Inverse field is not a Many2one field",
* -> current_model is not right
*/
OLS03023, DiagnosticSetting::Error, "Inverse field {0} is not pointing to the current model {1}, but rather to {2}",
/**
* Models declared in a function are not supported by OdooLS. This info is indicating that no features will be enabled for this model.
*/
OLS03024, DiagnosticSetting::Info, "Models declared in a function are not supported by OdooLS. OdooLS will use it as a normal class for the rest of the function only",
/**
* Form is no longer available on odoo.tests.common, thus it should not be imported from there.
*/
Expand Down
13 changes: 11 additions & 2 deletions server/src/core/python_arch_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,17 @@ impl PythonArchEval {
self.visit_sub_stmts(session, &class_stmt.body);
self.sym_stack.pop();
if !self.sym_stack[0].borrow().is_external() && self.sym_stack[0].borrow().get_entry().is_some_and(|e| e.borrow().typ == EntryPointType::MAIN) {
let odoo_builder_diags = PythonOdooBuilder::new(class_sym_rc).load(session);
self.diagnostics.extend(odoo_builder_diags);
if class_sym_rc.borrow().get_in_parents(&vec![SymType::FUNCTION], true).is_some() {
if let Some(diagnostic) = create_diagnostic(&session, DiagnosticCode::OLS03024, &[]) {
self.diagnostics.push(Diagnostic {
range: FileMgr::textRange_to_temporary_Range(&class_stmt.name.range),
..diagnostic
});
}
} else {
let odoo_builder_diags = PythonOdooBuilder::new(class_sym_rc).load(session);
self.diagnostics.extend(odoo_builder_diags);
}
}
session.current_noqa = old_noqa;
}
Expand Down