@@ -561,11 +561,8 @@ def goto_partner_not_found(self, parsed_inv, error_message):
561
561
if country :
562
562
vals ["partner_country_id" ] = country .id
563
563
self .write (vals )
564
- action = (
565
- self .env .ref ("account_invoice_import.account_invoice_import_action" )
566
- .sudo ()
567
- .read ()[0 ]
568
- )
564
+ xmlid = "account_invoice_import.account_invoice_import_action"
565
+ action = self .env ["ir.actions.act_window" ]._for_xml_id (xmlid )
569
566
action ["res_id" ] = self .id
570
567
return action
571
568
@@ -747,11 +744,8 @@ def import_invoice(self):
747
744
748
745
if not wiz_vals .get ("import_config_id" ):
749
746
wiz_vals ["state" ] = "config"
750
- action = (
751
- self .env .ref ("account_invoice_import.account_invoice_import_action" )
752
- .sudo ()
753
- .read ()[0 ]
754
- )
747
+ xmlid = "account_invoice_import.account_invoice_import_action"
748
+ action = self .env ["ir.actions.act_window" ]._for_xml_id (xmlid )
755
749
action ["res_id" ] = self .id
756
750
else :
757
751
draft_same_supplier_invs = amo .search (
@@ -766,11 +760,8 @@ def import_invoice(self):
766
760
wiz_vals ["state" ] = "update"
767
761
if len (draft_same_supplier_invs ) == 1 :
768
762
wiz_vals ["invoice_id" ] = draft_same_supplier_invs [0 ].id
769
- action = (
770
- self .env .ref ("account_invoice_import.account_invoice_import_action" )
771
- .sudo ()
772
- .read ()[0 ]
773
- )
763
+ xmlid = "account_invoice_import.account_invoice_import_action"
764
+ action = self .env ["ir.actions.act_window" ]._for_xml_id (xmlid )
774
765
action ["res_id" ] = self .id
775
766
else :
776
767
action = self .create_invoice_action (
@@ -793,7 +784,8 @@ def create_invoice_action(self, parsed_inv=None, import_config=None, origin=None
793
784
assert self .import_config_id
794
785
import_config = self .import_config_id .convert_to_import_config ()
795
786
invoice = self .create_invoice (parsed_inv , import_config , origin )
796
- action = self .env .ref ("account.action_move_in_invoice_type" ).sudo ().read ()[0 ]
787
+ xmlid = "account.action_move_in_invoice_type"
788
+ action = self .env ["ir.actions.act_window" ]._for_xml_id (xmlid )
797
789
action .update (
798
790
{
799
791
"view_mode" : "form,tree,kanban" ,
@@ -1271,7 +1263,8 @@ def update_invoice(self):
1271
1263
)
1272
1264
% self .invoice_filename
1273
1265
)
1274
- action = self .env .ref ("account.action_move_in_invoice_type" ).sudo ().read ()[0 ]
1266
+ xmlid = "account.action_move_in_invoice_type"
1267
+ action = self .env ["ir.actions.act_window" ]._for_xml_id (xmlid )
1275
1268
action .update (
1276
1269
{
1277
1270
"view_mode" : "form,tree,kanban" ,
0 commit comments