@@ -6,7 +6,7 @@ use regex::Regex;
6
6
use roxmltree:: Node ;
7
7
use tracing:: { error, warn} ;
8
8
9
- use crate :: { constants:: { BuildStatus , BuildSteps , OYarn , EXTENSION_NAME } , core:: xml_data:: { XmlData , XmlDataActWindow , XmlDataDelete , XmlDataField , XmlDataMenuItem , XmlDataRecord , XmlDataReport , XmlDataTemplate } , oyarn, threads:: SessionInfo , Sy , S } ;
9
+ use crate :: { constants:: { BuildStatus , BuildSteps , OYarn , EXTENSION_NAME } , core:: xml_data:: { XmlData , XmlDataDelete , XmlDataField , XmlDataMenuItem , XmlDataRecord , XmlDataTemplate } , oyarn, threads:: SessionInfo , Sy , S } ;
10
10
11
11
use super :: { file_mgr:: FileInfo , odoo:: SyncOdoo , symbols:: { symbol:: Symbol , xml_file_symbol:: XmlFileSymbol } , xml_arch_builder:: XmlArchBuilder } ;
12
12
@@ -40,8 +40,6 @@ impl XmlArchBuilder {
40
40
|| self . load_record ( session, & child, diagnostics)
41
41
|| self . load_template ( session, & child, diagnostics)
42
42
|| self . load_delete ( session, & child, diagnostics)
43
- || self . load_act_window ( session, & child, diagnostics)
44
- || self . load_report ( session, & child, diagnostics)
45
43
|| self . load_function ( session, & child, diagnostics)
46
44
|| child. is_text ( ) || child. is_comment ( ) ) {
47
45
diagnostics. push ( Diagnostic :: new (
@@ -578,137 +576,6 @@ impl XmlArchBuilder {
578
576
true
579
577
}
580
578
581
- fn load_act_window ( & mut self , session : & mut SessionInfo , node : & Node , diagnostics : & mut Vec < Diagnostic > ) -> bool {
582
- if node. tag_name ( ) . name ( ) != "act_window" { return false ; }
583
- let mut found_id = None ;
584
- for attr in [ "id" , "name" , "res_model" ] {
585
- if node. attribute ( attr) . is_none ( ) {
586
- diagnostics. push ( Diagnostic :: new (
587
- Range { start : Position :: new ( node. range ( ) . start as u32 , 0 ) , end : Position :: new ( node. range ( ) . end as u32 , 0 ) } ,
588
- Some ( DiagnosticSeverity :: ERROR ) ,
589
- Some ( lsp_types:: NumberOrString :: String ( S ! ( "OLS304032" ) ) ) ,
590
- Some ( EXTENSION_NAME . to_string ( ) ) ,
591
- format ! ( "act_window node must contain a {} attribute" , attr) ,
592
- None ,
593
- None ) ) ;
594
- }
595
- if attr == "id" {
596
- found_id = Some ( node. attribute ( attr) . unwrap ( ) . to_string ( ) ) ;
597
- }
598
- }
599
- for attr in node. attributes ( ) {
600
- match attr. name ( ) {
601
- "id" | "name" | "res_model" => { } ,
602
- "domain" | "view_mode" | "view_id" | "target" | "context" | "groups" | "limit" | "usage" | "binding_model" => { } ,
603
- "binding_type" => {
604
- if attr. value ( ) != "action" && attr. value ( ) != "report" {
605
- diagnostics. push ( Diagnostic :: new (
606
- Range { start : Position :: new ( attr. range ( ) . start as u32 , 0 ) , end : Position :: new ( attr. range ( ) . end as u32 , 0 ) } ,
607
- Some ( DiagnosticSeverity :: ERROR ) ,
608
- Some ( lsp_types:: NumberOrString :: String ( S ! ( "OLS304034" ) ) ) ,
609
- Some ( EXTENSION_NAME . to_string ( ) ) ,
610
- format ! ( "binding_type attribute must be either 'action' or 'report', found {}" , attr. value( ) ) ,
611
- None ,
612
- None ) ) ;
613
- }
614
- } ,
615
- "binding_views" => {
616
- if !BINDING_VIEWS_RE . is_match ( attr. value ( ) ) {
617
- diagnostics. push ( Diagnostic :: new (
618
- Range { start : Position :: new ( attr. range ( ) . start as u32 , 0 ) , end : Position :: new ( attr. range ( ) . end as u32 , 0 ) } ,
619
- Some ( DiagnosticSeverity :: ERROR ) ,
620
- Some ( lsp_types:: NumberOrString :: String ( S ! ( "OLS304035" ) ) ) ,
621
- Some ( EXTENSION_NAME . to_string ( ) ) ,
622
- format ! ( "binding_views attribute must be a comma-separated list of view types matching ^([a-z]+(,[a-z]+)*)?$, found {}" , attr. value( ) ) ,
623
- None ,
624
- None ) ) ;
625
- }
626
- } ,
627
- _ => {
628
- diagnostics. push ( Diagnostic :: new (
629
- Range { start : Position :: new ( attr. range ( ) . start as u32 , 0 ) , end : Position :: new ( attr. range ( ) . end as u32 , 0 ) } ,
630
- Some ( DiagnosticSeverity :: ERROR ) ,
631
- Some ( lsp_types:: NumberOrString :: String ( S ! ( "OLS304033" ) ) ) ,
632
- Some ( EXTENSION_NAME . to_string ( ) ) ,
633
- format ! ( "Invalid attribute {} in act_window node" , attr. name( ) ) ,
634
- None ,
635
- None ) ) ;
636
- }
637
- }
638
- }
639
- if node. text ( ) . is_some ( ) {
640
- diagnostics. push ( Diagnostic :: new (
641
- Range { start : Position :: new ( node. range ( ) . start as u32 , 0 ) , end : Position :: new ( node. range ( ) . end as u32 , 0 ) } ,
642
- Some ( DiagnosticSeverity :: ERROR ) ,
643
- Some ( lsp_types:: NumberOrString :: String ( S ! ( "OLS304033" ) ) ) ,
644
- Some ( EXTENSION_NAME . to_string ( ) ) ,
645
- format ! ( "act_window node cannot have text content" ) ,
646
- None ,
647
- None ) ) ;
648
- }
649
- let data = XmlData :: ACT_WINDOW ( XmlDataActWindow {
650
- file_symbol : Rc :: downgrade ( & self . xml_symbol ) ,
651
- xml_id : found_id. clone ( ) . map ( |id| oyarn ! ( "{}" , id) ) ,
652
- res_model : Sy ! ( node. attribute( "res_model" ) . unwrap( ) . to_string( ) ) ,
653
- name : Sy ! ( node. attribute( "name" ) . unwrap( ) . to_string( ) ) ,
654
- } ) ;
655
- self . on_operation_creation ( session, found_id, node, data, diagnostics) ;
656
- true
657
- }
658
-
659
- fn load_report ( & mut self , session : & mut SessionInfo , node : & Node , diagnostics : & mut Vec < Diagnostic > ) -> bool {
660
- if node. tag_name ( ) . name ( ) != "report" { return false ; }
661
- let mut found_id = None ;
662
- for attr in [ "string" , "model" , "name" ] {
663
- if node. attribute ( attr) . is_none ( ) {
664
- diagnostics. push ( Diagnostic :: new (
665
- Range { start : Position :: new ( node. range ( ) . start as u32 , 0 ) , end : Position :: new ( node. range ( ) . end as u32 , 0 ) } ,
666
- Some ( DiagnosticSeverity :: ERROR ) ,
667
- Some ( lsp_types:: NumberOrString :: String ( S ! ( "OLS304036" ) ) ) ,
668
- Some ( EXTENSION_NAME . to_string ( ) ) ,
669
- format ! ( "report node must contain a {} attribute" , attr) ,
670
- None ,
671
- None ) ) ;
672
- }
673
- }
674
- for attr in node. attributes ( ) {
675
- match attr. name ( ) {
676
- "id" => { found_id = Some ( attr. value ( ) . to_string ( ) ) ; } ,
677
- "print_report_name" | "report_type" | "multi" | "menu" | "keyword" | "file" |
678
- "xml" | "parser" | "auto" | "header" | "attachment" | "attachment_use" | "groups" | "paperformat" | "usage" => { } ,
679
- _ => {
680
- diagnostics. push ( Diagnostic :: new (
681
- Range { start : Position :: new ( attr. range ( ) . start as u32 , 0 ) , end : Position :: new ( attr. range ( ) . end as u32 , 0 ) } ,
682
- Some ( DiagnosticSeverity :: ERROR ) ,
683
- Some ( lsp_types:: NumberOrString :: String ( S ! ( "OLS304037" ) ) ) ,
684
- Some ( EXTENSION_NAME . to_string ( ) ) ,
685
- format ! ( "Invalid attribute {} in report node" , attr. name( ) ) ,
686
- None ,
687
- None ) ) ;
688
- }
689
- }
690
- }
691
- if node. text ( ) . is_some ( ) {
692
- diagnostics. push ( Diagnostic :: new (
693
- Range { start : Position :: new ( node. range ( ) . start as u32 , 0 ) , end : Position :: new ( node. range ( ) . end as u32 , 0 ) } ,
694
- Some ( DiagnosticSeverity :: ERROR ) ,
695
- Some ( lsp_types:: NumberOrString :: String ( S ! ( "OLS304038" ) ) ) ,
696
- Some ( EXTENSION_NAME . to_string ( ) ) ,
697
- format ! ( "report node cannot have text content" ) ,
698
- None ,
699
- None ) ) ;
700
- }
701
- let data = XmlData :: REPORT ( XmlDataReport {
702
- file_symbol : Rc :: downgrade ( & self . xml_symbol ) ,
703
- xml_id : found_id. clone ( ) . map ( |id| oyarn ! ( "{}" , id) ) ,
704
- name : Sy ! ( node. attribute( "name" ) . unwrap( ) . to_string( ) ) ,
705
- model : Sy ! ( node. attribute( "model" ) . unwrap( ) . to_string( ) ) ,
706
- string : Sy ! ( node. attribute( "string" ) . unwrap( ) . to_string( ) ) ,
707
- } ) ;
708
- self . on_operation_creation ( session, found_id, node, data, diagnostics) ;
709
- true
710
- }
711
-
712
579
fn load_function ( & mut self , session : & mut SessionInfo , node : & Node , diagnostics : & mut Vec < Diagnostic > ) -> bool {
713
580
if node. tag_name ( ) . name ( ) != "function" { return false ; }
714
581
for attr in [ "model" , "name" ] {
0 commit comments