@@ -233,6 +233,76 @@ def order_creation(self, date_prefered):
233233 self .assertEqual (order .move_ids [0 ].date , order .payment_ids [0 ].date )
234234 self .assertEqual (order .state , "uploaded" )
235235
236+ def test_wizard_filters_by_account_id (self ):
237+ if self .invoice .state != "posted" :
238+ self .invoice .action_post ()
239+ order = self .env ["account.payment.order" ].create (
240+ {
241+ "payment_type" : "outbound" ,
242+ "payment_mode_id" : self .mode .id ,
243+ }
244+ )
245+ other_payable_account = self .env ["account.account" ].create (
246+ {
247+ "name" : "Other Payable Test" ,
248+ "code" : "PAYTEST" ,
249+ "account_type" : "liability_payable" ,
250+ "company_id" : self .company .id ,
251+ }
252+ )
253+ wizard_filtered = (
254+ self .env ["account.payment.line.create" ]
255+ .with_context (active_model = "account.payment.order" , active_id = order .id )
256+ .create (
257+ {
258+ "date_type" : "move" ,
259+ "move_date" : fields .Date .today (),
260+ "account_id" : other_payable_account .id ,
261+ }
262+ )
263+ )
264+ wizard_filtered .payment_mode = "any"
265+ wizard_filtered .populate ()
266+ self .assertFalse (wizard_filtered .move_line_ids )
267+
268+ def test_wizard_filters_by_analytic_account (self ):
269+ if self .invoice .state != "posted" :
270+ self .invoice .action_post ()
271+ order = self .env ["account.payment.order" ].create (
272+ {
273+ "payment_type" : "outbound" ,
274+ "payment_mode_id" : self .mode .id ,
275+ }
276+ )
277+ plan = self .env ["account.analytic.plan" ].search (
278+ [("company_id" , "=" , self .company .id )], limit = 1
279+ )
280+ if not plan :
281+ plan = self .env ["account.analytic.plan" ].create (
282+ {"name" : "Wizard Analytic Plan" , "company_id" : self .company .id }
283+ )
284+ analytic_account = self .env ["account.analytic.account" ].create (
285+ {
286+ "name" : "Wizard Analytic Test" ,
287+ "company_id" : self .company .id ,
288+ "plan_id" : plan .id ,
289+ }
290+ )
291+ wizard_analytic = (
292+ self .env ["account.payment.line.create" ]
293+ .with_context (active_model = "account.payment.order" , active_id = order .id )
294+ .create (
295+ {
296+ "date_type" : "move" ,
297+ "move_date" : fields .Date .today (),
298+ "analytic_account_id" : analytic_account .id ,
299+ }
300+ )
301+ )
302+ wizard_analytic .payment_mode = "any"
303+ wizard_analytic .populate ()
304+ self .assertFalse (wizard_analytic .move_line_ids )
305+
236306 def _line_creation (self , outbound_order ):
237307 vals = {
238308 "order_id" : outbound_order .id ,
0 commit comments