Coverage for ingadhoc-account-payment / account_payment_pro / models / account_journal.py: 31%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-09 19:54 +0000

1# © 2024 ADHOC SA 

2# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). 

3 

4from odoo import _, models 

5from odoo.exceptions import ValidationError 

6 

7 

8class AccountJournal(models.Model): 

9 _inherit = "account.journal" 

10 

11 def _get_manual_payment_method_id(self, direction="inbound"): 

12 self.ensure_one() 

13 if direction == "inbound": 

14 payment_method = self.inbound_payment_method_line_ids.payment_method_id.filtered( 

15 lambda x: x.code == "manual" 

16 ) 

17 else: 

18 payment_method = self.outbound_payment_method_line_ids.payment_method_id.filtered( 

19 lambda x: x.code == "manual" 

20 ) 

21 if not payment_method: 

22 raise ValidationError(_("Journal must have manual method!")) 

23 return payment_method