@@ -242,9 +242,7 @@ def _prepare_create_invoice_journal(self, parsed_inv, import_config, company, va
242
242
else :
243
243
journal_id = (
244
244
self .env ["account.move" ]
245
- .with_context (
246
- default_move_type = parsed_inv ["type" ], company_id = company .id
247
- )
245
+ .with_context (default_type = parsed_inv ["type" ], company_id = company .id )
248
246
._get_default_journal ()
249
247
.id
250
248
)
@@ -259,13 +257,13 @@ def _prepare_create_invoice_vals(self, parsed_inv, import_config):
259
257
or self .env .company
260
258
)
261
259
vals = {
262
- "move_type " : parsed_inv ["type" ],
260
+ "type " : parsed_inv ["type" ],
263
261
"company_id" : company .id ,
264
262
"invoice_origin" : parsed_inv .get ("origin" ),
265
263
"ref" : parsed_inv .get ("invoice_number" ),
266
264
"invoice_date" : parsed_inv .get ("date" ),
267
265
"narration" : parsed_inv .get ("narration" ),
268
- "payment_reference " : parsed_inv .get ("payment_reference" ),
266
+ "invoice_payment_ref " : parsed_inv .get ("payment_reference" ),
269
267
"invoice_line_ids" : [],
270
268
}
271
269
if parsed_inv ["type" ] in ("out_invoice" , "out_refund" ):
@@ -300,7 +298,7 @@ def _prepare_create_invoice_vals(self, parsed_inv, import_config):
300
298
# set by invoice_date + invoice_payment_term_id otherwise
301
299
vals ["invoice_payment_term_id" ] = False
302
300
# Bank info
303
- if parsed_inv .get ("iban" ) and vals ["move_type " ] == "in_invoice" :
301
+ if parsed_inv .get ("iban" ) and vals ["type " ] == "in_invoice" :
304
302
partner_bank = self ._match_partner_bank (
305
303
partner ,
306
304
parsed_inv ["iban" ],
@@ -639,7 +637,7 @@ def invoice_already_exists(self, commercial_partner, parsed_inv):
639
637
[
640
638
("company_id" , "=" , company_id ),
641
639
("commercial_partner_id" , "=" , commercial_partner .id ),
642
- ("move_type " , "=" , parsed_inv ["type" ]),
640
+ ("type " , "=" , parsed_inv ["type" ]),
643
641
("ref" , "=ilike" , parsed_inv .get ("invoice_number" )),
644
642
],
645
643
limit = 1 ,
@@ -667,8 +665,9 @@ def goto_partner_not_found(self, parsed_inv, error_message):
667
665
if country :
668
666
vals ["partner_country_id" ] = country .id
669
667
self .write (vals )
670
- xmlid = "account_invoice_import.account_invoice_import_action"
671
- action = self .env ["ir.actions.act_window" ]._for_xml_id (xmlid )
668
+ action = self .env ["ir.actions.act_window" ].for_xml_id (
669
+ "account_invoice_import" , "account_invoice_import_action"
670
+ )
672
671
action ["res_id" ] = self .id
673
672
return action
674
673
@@ -861,14 +860,15 @@ def import_invoice(self):
861
860
862
861
if not wiz_vals .get ("import_config_id" ):
863
862
wiz_vals ["state" ] = "config"
864
- xmlid = "account_invoice_import.account_invoice_import_action"
865
- action = self .env ["ir.actions.act_window" ]._for_xml_id (xmlid )
863
+ action = self .env ["ir.actions.act_window" ].for_xml_id (
864
+ "account_invoice_import" , "account_invoice_import_action"
865
+ )
866
866
action ["res_id" ] = self .id
867
867
else :
868
868
draft_same_supplier_invs = amo .search (
869
869
[
870
870
("commercial_partner_id" , "=" , partner .id ),
871
- ("move_type " , "=" , parsed_inv ["type" ]),
871
+ ("type " , "=" , parsed_inv ["type" ]),
872
872
("state" , "=" , "draft" ),
873
873
]
874
874
)
@@ -877,8 +877,9 @@ def import_invoice(self):
877
877
wiz_vals ["state" ] = "update"
878
878
if len (draft_same_supplier_invs ) == 1 :
879
879
wiz_vals ["invoice_id" ] = draft_same_supplier_invs [0 ].id
880
- xmlid = "account_invoice_import.account_invoice_import_action"
881
- action = self .env ["ir.actions.act_window" ]._for_xml_id (xmlid )
880
+ action = self .env ["ir.actions.act_window" ].for_xml_id (
881
+ "account_invoice_import" , "account_invoice_import_action"
882
+ )
882
883
action ["res_id" ] = self .id
883
884
else :
884
885
action = self .create_invoice_action (
@@ -905,8 +906,9 @@ def create_invoice_action(self, parsed_inv=None, import_config=None, origin=None
905
906
assert self .import_config_id
906
907
import_config = self .import_config_id .convert_to_import_config ()
907
908
invoice = self .create_invoice (parsed_inv , import_config , origin )
908
- xmlid = "account.action_move_in_invoice_type"
909
- action = self .env ["ir.actions.act_window" ]._for_xml_id (xmlid )
909
+ action = self .env ["ir.actions.act_window" ].for_xml_id (
910
+ "account" , "action_move_in_invoice_type"
911
+ )
910
912
action .update (
911
913
{
912
914
"view_mode" : "form,tree,kanban" ,
@@ -1024,7 +1026,7 @@ def _prepare_global_adjustment_line(self, diff_amount, invoice, import_config):
1024
1026
accounts = import_config ["product" ].product_tmpl_id .get_product_accounts (
1025
1027
fiscal_pos = invoice .fiscal_position_id
1026
1028
)
1027
- if invoice .move_type in ("out_invoice" , "out_refund" ):
1029
+ if invoice .type in ("out_invoice" , "out_refund" ):
1028
1030
account = accounts ["income" ]
1029
1031
else :
1030
1032
account = accounts ["expense" ]
@@ -1420,8 +1422,9 @@ def update_invoice(self):
1420
1422
)
1421
1423
% self .invoice_filename
1422
1424
)
1423
- xmlid = "account.action_move_in_invoice_type"
1424
- action = self .env ["ir.actions.act_window" ]._for_xml_id (xmlid )
1425
+ action = self .env ["ir.actions.act_window" ].for_xml_id (
1426
+ "account" , "action_move_in_invoice_type"
1427
+ )
1425
1428
action .update (
1426
1429
{
1427
1430
"view_mode" : "form,tree,kanban" ,
0 commit comments