11# Copyright 2021 Simone Rubino - Agile Business Group
2+ # Copyright 2023 Simone Rubino - Aion Tech
23# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
34
45from odoo .tests import Form , tagged
@@ -39,7 +40,9 @@ def setup_withholding_data(cls, company_data):
3940 """
4041 cls .set_allowed_companies (company_data ["company" ])
4142 wh_tax = cls .setup_withholding_tax (company_data )
42- invoice = cls .init_invoice ("in_invoice" , amounts = [100 ])
43+ invoice = cls .init_invoice (
44+ "in_invoice" , amounts = [100 ], company = company_data ["company" ]
45+ )
4346 invoice_form = Form (invoice )
4447 with invoice_form .invoice_line_ids .edit (0 ) as line_form :
4548 line_form .invoice_line_tax_wt_ids .clear ()
@@ -56,7 +59,9 @@ def set_allowed_companies(cls, company):
5659 """
5760 context = {"allowed_company_ids" : company .ids }
5861 if "allowed_company_ids" in cls .env .context :
59- cls .env .context .pop ("allowed_company_ids" )
62+ ctx = dict (cls .env .context )
63+ ctx .pop ("allowed_company_ids" )
64+ cls .env .context = ctx
6065 cls .env .context = dict (** cls .env .context , ** context )
6166
6267 @classmethod
@@ -91,7 +96,10 @@ def generate_withholding_tax_payment(self, invoice):
9196 )
9297 wh_tax_payment_wizard = (
9398 self .env ["wizard.wt.move.payment.create" ]
94- .with_context (active_model = wh_tax_move ._name , active_ids = wh_tax_move .ids )
99+ .with_context (
100+ active_model = wh_tax_move ._name ,
101+ active_ids = wh_tax_move .ids ,
102+ )
95103 .create ({})
96104 )
97105 wh_tax_payment_action = wh_tax_payment_wizard .generate ()
0 commit comments